=begin
#Klaviyo API
#The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details.
The version of the OpenAPI document: 2025-01-15
Contact: developers@klaviyo.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.2.1
=end
require 'cgi'
module KlaviyoAPI
class CatalogsApi
attr_accessor :api_client
def initialize(api_client = ApiClient.default)
@api_client = api_client
end
# Add Categories to Catalog Item
# Create a new catalog category relationship for the given item ID.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param catalog_item_category_op [CatalogItemCategoryOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def add_categories_to_catalog_item(id, catalog_item_category_op, opts = {})
add_categories_to_catalog_item_with_http_info(id, catalog_item_category_op, opts)
nil
end
# alias of `add_categories_to_catalog_item`
alias add_category_to_catalog_item add_categories_to_catalog_item
# alias of `add_categories_to_catalog_item`
alias create_catalog_item_relationships_category add_categories_to_catalog_item
# alias of `add_categories_to_catalog_item`
alias create_catalog_item_relationships_categories add_categories_to_catalog_item
# Add Categories to Catalog Item
# Create a new catalog category relationship for the given item ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param catalog_item_category_op [CatalogItemCategoryOp]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def add_categories_to_catalog_item_with_http_info(id, catalog_item_category_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.add_categories_to_catalog_item ...'
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 CatalogsApi.add_categories_to_catalog_item"
end
# verify the required parameter 'catalog_item_category_op' is set
if @api_client.config.client_side_validation && catalog_item_category_op.nil?
fail ArgumentError, "Missing the required parameter 'catalog_item_category_op' when calling CatalogsApi.add_categories_to_catalog_item"
end
# resource path
local_var_path = '/api/catalog-items/{id}/relationships/categories'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_item_category_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.add_categories_to_catalog_item",
:header_params => header_params,
:query_params => query_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: CatalogsApi#add_categories_to_catalog_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `add_categories_to_catalog_item_with_http_info`
alias add_category_to_catalog_item_with_http_info add_categories_to_catalog_item_with_http_info
# alias of `add_categories_to_catalog_item_with_http_info`
alias create_catalog_item_relationships_category_with_http_info add_categories_to_catalog_item_with_http_info
# alias of `add_categories_to_catalog_item_with_http_info`
alias create_catalog_item_relationships_categories_with_http_info add_categories_to_catalog_item_with_http_info
# Add Items to Catalog Category
# Create a new item relationship for the given category ID.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String] The catalog category ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param catalog_category_item_op [CatalogCategoryItemOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def add_items_to_catalog_category(id, catalog_category_item_op, opts = {})
add_items_to_catalog_category_with_http_info(id, catalog_category_item_op, opts)
nil
end
# alias of `add_items_to_catalog_category`
alias create_catalog_category_relationships_item add_items_to_catalog_category
# alias of `add_items_to_catalog_category`
alias create_catalog_category_relationships_items add_items_to_catalog_category
# Add Items to Catalog Category
# Create a new item relationship for the given category ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String] The catalog category ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param catalog_category_item_op [CatalogCategoryItemOp]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def add_items_to_catalog_category_with_http_info(id, catalog_category_item_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.add_items_to_catalog_category ...'
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 CatalogsApi.add_items_to_catalog_category"
end
# verify the required parameter 'catalog_category_item_op' is set
if @api_client.config.client_side_validation && catalog_category_item_op.nil?
fail ArgumentError, "Missing the required parameter 'catalog_category_item_op' when calling CatalogsApi.add_items_to_catalog_category"
end
# resource path
local_var_path = '/api/catalog-categories/{id}/relationships/items'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_category_item_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.add_items_to_catalog_category",
:header_params => header_params,
:query_params => query_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: CatalogsApi#add_items_to_catalog_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `add_items_to_catalog_category_with_http_info`
alias create_catalog_category_relationships_item_with_http_info add_items_to_catalog_category_with_http_info
# alias of `add_items_to_catalog_category_with_http_info`
alias create_catalog_category_relationships_items_with_http_info add_items_to_catalog_category_with_http_info
# Bulk Create Catalog Categories
# Create a catalog category bulk create job to create a batch of catalog categories. Accepts up to 100 catalog categories per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_category_create_job_create_query [CatalogCategoryCreateJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def bulk_create_catalog_categories(catalog_category_create_job_create_query, opts = {})
data, _status_code, _headers = bulk_create_catalog_categories_with_http_info(catalog_category_create_job_create_query, opts)
data
end
# alias of `bulk_create_catalog_categories`
alias spawn_create_categories_job bulk_create_catalog_categories
# alias of `bulk_create_catalog_categories`
alias create_catalog_category_bulk_create_job bulk_create_catalog_categories
# Bulk Create Catalog Categories
# Create a catalog category bulk create job to create a batch of catalog categories. Accepts up to 100 catalog categories per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_category_create_job_create_query [CatalogCategoryCreateJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def bulk_create_catalog_categories_with_http_info(catalog_category_create_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.bulk_create_catalog_categories ...'
end
# verify the required parameter 'catalog_category_create_job_create_query' is set
if @api_client.config.client_side_validation && catalog_category_create_job_create_query.nil?
fail ArgumentError, "Missing the required parameter 'catalog_category_create_job_create_query' when calling CatalogsApi.bulk_create_catalog_categories"
end
# resource path
local_var_path = '/api/catalog-category-bulk-create-jobs'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_category_create_job_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.bulk_create_catalog_categories",
:header_params => header_params,
:query_params => query_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: CatalogsApi#bulk_create_catalog_categories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `bulk_create_catalog_categories_with_http_info`
alias spawn_create_categories_job_with_http_info bulk_create_catalog_categories_with_http_info
# alias of `bulk_create_catalog_categories_with_http_info`
alias create_catalog_category_bulk_create_job_with_http_info bulk_create_catalog_categories_with_http_info
# Bulk Create Catalog Items
# Create a catalog item bulk create job to create a batch of catalog items. Accepts up to 100 catalog items per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_item_create_job_create_query [CatalogItemCreateJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def bulk_create_catalog_items(catalog_item_create_job_create_query, opts = {})
data, _status_code, _headers = bulk_create_catalog_items_with_http_info(catalog_item_create_job_create_query, opts)
data
end
# alias of `bulk_create_catalog_items`
alias spawn_create_items_job bulk_create_catalog_items
# alias of `bulk_create_catalog_items`
alias create_catalog_item_bulk_create_job bulk_create_catalog_items
# Bulk Create Catalog Items
# Create a catalog item bulk create job to create a batch of catalog items. Accepts up to 100 catalog items per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_item_create_job_create_query [CatalogItemCreateJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def bulk_create_catalog_items_with_http_info(catalog_item_create_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.bulk_create_catalog_items ...'
end
# verify the required parameter 'catalog_item_create_job_create_query' is set
if @api_client.config.client_side_validation && catalog_item_create_job_create_query.nil?
fail ArgumentError, "Missing the required parameter 'catalog_item_create_job_create_query' when calling CatalogsApi.bulk_create_catalog_items"
end
# resource path
local_var_path = '/api/catalog-item-bulk-create-jobs'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_item_create_job_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.bulk_create_catalog_items",
:header_params => header_params,
:query_params => query_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: CatalogsApi#bulk_create_catalog_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `bulk_create_catalog_items_with_http_info`
alias spawn_create_items_job_with_http_info bulk_create_catalog_items_with_http_info
# alias of `bulk_create_catalog_items_with_http_info`
alias create_catalog_item_bulk_create_job_with_http_info bulk_create_catalog_items_with_http_info
# Bulk Create Catalog Variants
# Create a catalog variant bulk create job to create a batch of catalog variants. Accepts up to 100 catalog variants per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_variant_create_job_create_query [CatalogVariantCreateJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def bulk_create_catalog_variants(catalog_variant_create_job_create_query, opts = {})
data, _status_code, _headers = bulk_create_catalog_variants_with_http_info(catalog_variant_create_job_create_query, opts)
data
end
# alias of `bulk_create_catalog_variants`
alias spawn_create_variants_job bulk_create_catalog_variants
# alias of `bulk_create_catalog_variants`
alias create_catalog_variant_bulk_create_job bulk_create_catalog_variants
# Bulk Create Catalog Variants
# Create a catalog variant bulk create job to create a batch of catalog variants. Accepts up to 100 catalog variants per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_variant_create_job_create_query [CatalogVariantCreateJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def bulk_create_catalog_variants_with_http_info(catalog_variant_create_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.bulk_create_catalog_variants ...'
end
# verify the required parameter 'catalog_variant_create_job_create_query' is set
if @api_client.config.client_side_validation && catalog_variant_create_job_create_query.nil?
fail ArgumentError, "Missing the required parameter 'catalog_variant_create_job_create_query' when calling CatalogsApi.bulk_create_catalog_variants"
end
# resource path
local_var_path = '/api/catalog-variant-bulk-create-jobs'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_variant_create_job_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.bulk_create_catalog_variants",
:header_params => header_params,
:query_params => query_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: CatalogsApi#bulk_create_catalog_variants\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `bulk_create_catalog_variants_with_http_info`
alias spawn_create_variants_job_with_http_info bulk_create_catalog_variants_with_http_info
# alias of `bulk_create_catalog_variants_with_http_info`
alias create_catalog_variant_bulk_create_job_with_http_info bulk_create_catalog_variants_with_http_info
# Bulk Delete Catalog Categories
# Create a catalog category bulk delete job to delete a batch of catalog categories. Accepts up to 100 catalog categories per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_category_delete_job_create_query [CatalogCategoryDeleteJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def bulk_delete_catalog_categories(catalog_category_delete_job_create_query, opts = {})
data, _status_code, _headers = bulk_delete_catalog_categories_with_http_info(catalog_category_delete_job_create_query, opts)
data
end
# alias of `bulk_delete_catalog_categories`
alias spawn_delete_categories_job bulk_delete_catalog_categories
# alias of `bulk_delete_catalog_categories`
alias create_catalog_category_bulk_delete_job bulk_delete_catalog_categories
# Bulk Delete Catalog Categories
# Create a catalog category bulk delete job to delete a batch of catalog categories. Accepts up to 100 catalog categories per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_category_delete_job_create_query [CatalogCategoryDeleteJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def bulk_delete_catalog_categories_with_http_info(catalog_category_delete_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.bulk_delete_catalog_categories ...'
end
# verify the required parameter 'catalog_category_delete_job_create_query' is set
if @api_client.config.client_side_validation && catalog_category_delete_job_create_query.nil?
fail ArgumentError, "Missing the required parameter 'catalog_category_delete_job_create_query' when calling CatalogsApi.bulk_delete_catalog_categories"
end
# resource path
local_var_path = '/api/catalog-category-bulk-delete-jobs'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_category_delete_job_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.bulk_delete_catalog_categories",
:header_params => header_params,
:query_params => query_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: CatalogsApi#bulk_delete_catalog_categories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `bulk_delete_catalog_categories_with_http_info`
alias spawn_delete_categories_job_with_http_info bulk_delete_catalog_categories_with_http_info
# alias of `bulk_delete_catalog_categories_with_http_info`
alias create_catalog_category_bulk_delete_job_with_http_info bulk_delete_catalog_categories_with_http_info
# Bulk Delete Catalog Items
# Create a catalog item bulk delete job to delete a batch of catalog items. Accepts up to 100 catalog items per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_item_delete_job_create_query [CatalogItemDeleteJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def bulk_delete_catalog_items(catalog_item_delete_job_create_query, opts = {})
data, _status_code, _headers = bulk_delete_catalog_items_with_http_info(catalog_item_delete_job_create_query, opts)
data
end
# alias of `bulk_delete_catalog_items`
alias spawn_delete_items_job bulk_delete_catalog_items
# alias of `bulk_delete_catalog_items`
alias create_catalog_item_bulk_delete_job bulk_delete_catalog_items
# Bulk Delete Catalog Items
# Create a catalog item bulk delete job to delete a batch of catalog items. Accepts up to 100 catalog items per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_item_delete_job_create_query [CatalogItemDeleteJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def bulk_delete_catalog_items_with_http_info(catalog_item_delete_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.bulk_delete_catalog_items ...'
end
# verify the required parameter 'catalog_item_delete_job_create_query' is set
if @api_client.config.client_side_validation && catalog_item_delete_job_create_query.nil?
fail ArgumentError, "Missing the required parameter 'catalog_item_delete_job_create_query' when calling CatalogsApi.bulk_delete_catalog_items"
end
# resource path
local_var_path = '/api/catalog-item-bulk-delete-jobs'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_item_delete_job_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.bulk_delete_catalog_items",
:header_params => header_params,
:query_params => query_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: CatalogsApi#bulk_delete_catalog_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `bulk_delete_catalog_items_with_http_info`
alias spawn_delete_items_job_with_http_info bulk_delete_catalog_items_with_http_info
# alias of `bulk_delete_catalog_items_with_http_info`
alias create_catalog_item_bulk_delete_job_with_http_info bulk_delete_catalog_items_with_http_info
# Bulk Delete Catalog Variants
# Create a catalog variant bulk delete job to delete a batch of catalog variants. Accepts up to 100 catalog variants per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_variant_delete_job_create_query [CatalogVariantDeleteJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def bulk_delete_catalog_variants(catalog_variant_delete_job_create_query, opts = {})
data, _status_code, _headers = bulk_delete_catalog_variants_with_http_info(catalog_variant_delete_job_create_query, opts)
data
end
# alias of `bulk_delete_catalog_variants`
alias spawn_delete_variants_job bulk_delete_catalog_variants
# alias of `bulk_delete_catalog_variants`
alias create_catalog_variant_bulk_delete_job bulk_delete_catalog_variants
# Bulk Delete Catalog Variants
# Create a catalog variant bulk delete job to delete a batch of catalog variants. Accepts up to 100 catalog variants per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_variant_delete_job_create_query [CatalogVariantDeleteJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def bulk_delete_catalog_variants_with_http_info(catalog_variant_delete_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.bulk_delete_catalog_variants ...'
end
# verify the required parameter 'catalog_variant_delete_job_create_query' is set
if @api_client.config.client_side_validation && catalog_variant_delete_job_create_query.nil?
fail ArgumentError, "Missing the required parameter 'catalog_variant_delete_job_create_query' when calling CatalogsApi.bulk_delete_catalog_variants"
end
# resource path
local_var_path = '/api/catalog-variant-bulk-delete-jobs'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_variant_delete_job_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.bulk_delete_catalog_variants",
:header_params => header_params,
:query_params => query_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: CatalogsApi#bulk_delete_catalog_variants\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `bulk_delete_catalog_variants_with_http_info`
alias spawn_delete_variants_job_with_http_info bulk_delete_catalog_variants_with_http_info
# alias of `bulk_delete_catalog_variants_with_http_info`
alias create_catalog_variant_bulk_delete_job_with_http_info bulk_delete_catalog_variants_with_http_info
# Bulk Update Catalog Categories
# Create a catalog category bulk update job to update a batch of catalog categories. Accepts up to 100 catalog categories per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_category_update_job_create_query [CatalogCategoryUpdateJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def bulk_update_catalog_categories(catalog_category_update_job_create_query, opts = {})
data, _status_code, _headers = bulk_update_catalog_categories_with_http_info(catalog_category_update_job_create_query, opts)
data
end
# alias of `bulk_update_catalog_categories`
alias spawn_update_categories_job bulk_update_catalog_categories
# alias of `bulk_update_catalog_categories`
alias create_catalog_category_bulk_update_job bulk_update_catalog_categories
# Bulk Update Catalog Categories
# Create a catalog category bulk update job to update a batch of catalog categories. Accepts up to 100 catalog categories per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_category_update_job_create_query [CatalogCategoryUpdateJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def bulk_update_catalog_categories_with_http_info(catalog_category_update_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.bulk_update_catalog_categories ...'
end
# verify the required parameter 'catalog_category_update_job_create_query' is set
if @api_client.config.client_side_validation && catalog_category_update_job_create_query.nil?
fail ArgumentError, "Missing the required parameter 'catalog_category_update_job_create_query' when calling CatalogsApi.bulk_update_catalog_categories"
end
# resource path
local_var_path = '/api/catalog-category-bulk-update-jobs'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_category_update_job_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.bulk_update_catalog_categories",
:header_params => header_params,
:query_params => query_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: CatalogsApi#bulk_update_catalog_categories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `bulk_update_catalog_categories_with_http_info`
alias spawn_update_categories_job_with_http_info bulk_update_catalog_categories_with_http_info
# alias of `bulk_update_catalog_categories_with_http_info`
alias create_catalog_category_bulk_update_job_with_http_info bulk_update_catalog_categories_with_http_info
# Bulk Update Catalog Items
# Create a catalog item bulk update job to update a batch of catalog items. Accepts up to 100 catalog items per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_item_update_job_create_query [CatalogItemUpdateJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def bulk_update_catalog_items(catalog_item_update_job_create_query, opts = {})
data, _status_code, _headers = bulk_update_catalog_items_with_http_info(catalog_item_update_job_create_query, opts)
data
end
# alias of `bulk_update_catalog_items`
alias spawn_update_items_job bulk_update_catalog_items
# alias of `bulk_update_catalog_items`
alias create_catalog_item_bulk_update_job bulk_update_catalog_items
# Bulk Update Catalog Items
# Create a catalog item bulk update job to update a batch of catalog items. Accepts up to 100 catalog items per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_item_update_job_create_query [CatalogItemUpdateJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def bulk_update_catalog_items_with_http_info(catalog_item_update_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.bulk_update_catalog_items ...'
end
# verify the required parameter 'catalog_item_update_job_create_query' is set
if @api_client.config.client_side_validation && catalog_item_update_job_create_query.nil?
fail ArgumentError, "Missing the required parameter 'catalog_item_update_job_create_query' when calling CatalogsApi.bulk_update_catalog_items"
end
# resource path
local_var_path = '/api/catalog-item-bulk-update-jobs'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_item_update_job_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.bulk_update_catalog_items",
:header_params => header_params,
:query_params => query_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: CatalogsApi#bulk_update_catalog_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `bulk_update_catalog_items_with_http_info`
alias spawn_update_items_job_with_http_info bulk_update_catalog_items_with_http_info
# alias of `bulk_update_catalog_items_with_http_info`
alias create_catalog_item_bulk_update_job_with_http_info bulk_update_catalog_items_with_http_info
# Bulk Update Catalog Variants
# Create a catalog variant bulk update job to update a batch of catalog variants. Accepts up to 100 catalog variants per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_variant_update_job_create_query [CatalogVariantUpdateJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def bulk_update_catalog_variants(catalog_variant_update_job_create_query, opts = {})
data, _status_code, _headers = bulk_update_catalog_variants_with_http_info(catalog_variant_update_job_create_query, opts)
data
end
# alias of `bulk_update_catalog_variants`
alias spawn_update_variants_job bulk_update_catalog_variants
# alias of `bulk_update_catalog_variants`
alias create_catalog_variant_bulk_update_job bulk_update_catalog_variants
# Bulk Update Catalog Variants
# Create a catalog variant bulk update job to update a batch of catalog variants. Accepts up to 100 catalog variants per request. The maximum allowed payload size is 5MB. The maximum number of jobs in progress at one time is 500.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_variant_update_job_create_query [CatalogVariantUpdateJobCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def bulk_update_catalog_variants_with_http_info(catalog_variant_update_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.bulk_update_catalog_variants ...'
end
# verify the required parameter 'catalog_variant_update_job_create_query' is set
if @api_client.config.client_side_validation && catalog_variant_update_job_create_query.nil?
fail ArgumentError, "Missing the required parameter 'catalog_variant_update_job_create_query' when calling CatalogsApi.bulk_update_catalog_variants"
end
# resource path
local_var_path = '/api/catalog-variant-bulk-update-jobs'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_variant_update_job_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.bulk_update_catalog_variants",
:header_params => header_params,
:query_params => query_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: CatalogsApi#bulk_update_catalog_variants\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `bulk_update_catalog_variants_with_http_info`
alias spawn_update_variants_job_with_http_info bulk_update_catalog_variants_with_http_info
# alias of `bulk_update_catalog_variants_with_http_info`
alias create_catalog_variant_bulk_update_job_with_http_info bulk_update_catalog_variants_with_http_info
# Create Back In Stock Subscription
# Subscribe a profile to receive back in stock notifications. Check out [our Back in Stock API guide](https://developers.klaviyo.com/en/docs/how_to_set_up_custom_back_in_stock) for more details. This endpoint is specifically designed to be called from server-side applications. To create subscriptions from client-side contexts, use [POST /client/back-in-stock-subscriptions](https://developers.klaviyo.com/en/reference/create_client_back_in_stock_subscription).
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:write` `profiles:write`
# @param server_bis_subscription_create_query [ServerBISSubscriptionCreateQuery]
# @param [Hash] opts the optional parameters
# @return [nil]
def create_back_in_stock_subscription(server_bis_subscription_create_query, opts = {})
create_back_in_stock_subscription_with_http_info(server_bis_subscription_create_query, opts)
nil
end
# Create Back In Stock Subscription
# Subscribe a profile to receive back in stock notifications. Check out [our Back in Stock API guide](https://developers.klaviyo.com/en/docs/how_to_set_up_custom_back_in_stock) for more details. This endpoint is specifically designed to be called from server-side applications. To create subscriptions from client-side contexts, use [POST /client/back-in-stock-subscriptions](https://developers.klaviyo.com/en/reference/create_client_back_in_stock_subscription).<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:write` `profiles:write`
# @param server_bis_subscription_create_query [ServerBISSubscriptionCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def create_back_in_stock_subscription_with_http_info(server_bis_subscription_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.create_back_in_stock_subscription ...'
end
# verify the required parameter 'server_bis_subscription_create_query' is set
if @api_client.config.client_side_validation && server_bis_subscription_create_query.nil?
fail ArgumentError, "Missing the required parameter 'server_bis_subscription_create_query' when calling CatalogsApi.create_back_in_stock_subscription"
end
# resource path
local_var_path = '/api/back-in-stock-subscriptions'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(server_bis_subscription_create_query)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.create_back_in_stock_subscription",
:header_params => header_params,
:query_params => query_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: CatalogsApi#create_back_in_stock_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create Catalog Category
# Create a new catalog category.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_category_create_query [CatalogCategoryCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def create_catalog_category(catalog_category_create_query, opts = {})
data, _status_code, _headers = create_catalog_category_with_http_info(catalog_category_create_query, opts)
data
end
# Create Catalog Category
# Create a new catalog category.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_category_create_query [CatalogCategoryCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def create_catalog_category_with_http_info(catalog_category_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.create_catalog_category ...'
end
# verify the required parameter 'catalog_category_create_query' is set
if @api_client.config.client_side_validation && catalog_category_create_query.nil?
fail ArgumentError, "Missing the required parameter 'catalog_category_create_query' when calling CatalogsApi.create_catalog_category"
end
# resource path
local_var_path = '/api/catalog-categories'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_category_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.create_catalog_category",
:header_params => header_params,
:query_params => query_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: CatalogsApi#create_catalog_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create Catalog Item
# Create a new catalog item.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_item_create_query [CatalogItemCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def create_catalog_item(catalog_item_create_query, opts = {})
data, _status_code, _headers = create_catalog_item_with_http_info(catalog_item_create_query, opts)
data
end
# Create Catalog Item
# Create a new catalog item.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_item_create_query [CatalogItemCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def create_catalog_item_with_http_info(catalog_item_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.create_catalog_item ...'
end
# verify the required parameter 'catalog_item_create_query' is set
if @api_client.config.client_side_validation && catalog_item_create_query.nil?
fail ArgumentError, "Missing the required parameter 'catalog_item_create_query' when calling CatalogsApi.create_catalog_item"
end
# resource path
local_var_path = '/api/catalog-items'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_item_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.create_catalog_item",
:header_params => header_params,
:query_params => query_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: CatalogsApi#create_catalog_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create Catalog Variant
# Create a new variant for a related catalog item.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_variant_create_query [CatalogVariantCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def create_catalog_variant(catalog_variant_create_query, opts = {})
data, _status_code, _headers = create_catalog_variant_with_http_info(catalog_variant_create_query, opts)
data
end
# Create Catalog Variant
# Create a new variant for a related catalog item.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param catalog_variant_create_query [CatalogVariantCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def create_catalog_variant_with_http_info(catalog_variant_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.create_catalog_variant ...'
end
# verify the required parameter 'catalog_variant_create_query' is set
if @api_client.config.client_side_validation && catalog_variant_create_query.nil?
fail ArgumentError, "Missing the required parameter 'catalog_variant_create_query' when calling CatalogsApi.create_catalog_variant"
end
# resource path
local_var_path = '/api/catalog-variants'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/vnd.api+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(catalog_variant_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.create_catalog_variant",
:header_params => header_params,
:query_params => query_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: CatalogsApi#create_catalog_variant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete Catalog Category
# Delete a catalog category using the given category ID.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String] The catalog category ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_catalog_category(id, opts = {})
delete_catalog_category_with_http_info(id, opts)
nil
end
# Delete Catalog Category
# Delete a catalog category using the given category ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String] The catalog category ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_catalog_category_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.delete_catalog_category ...'
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 CatalogsApi.delete_catalog_category"
end
# resource path
local_var_path = '/api/catalog-categories/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.delete_catalog_category",
:header_params => header_params,
:query_params => query_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: CatalogsApi#delete_catalog_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete Catalog Item
# Delete a catalog item with the given item ID.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_catalog_item(id, opts = {})
delete_catalog_item_with_http_info(id, opts)
nil
end
# Delete Catalog Item
# Delete a catalog item with the given item ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_catalog_item_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.delete_catalog_item ...'
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 CatalogsApi.delete_catalog_item"
end
# resource path
local_var_path = '/api/catalog-items/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.delete_catalog_item",
:header_params => header_params,
:query_params => query_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: CatalogsApi#delete_catalog_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete Catalog Variant
# Delete a catalog item variant with the given variant ID.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String] The catalog variant ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_catalog_variant(id, opts = {})
delete_catalog_variant_with_http_info(id, opts)
nil
end
# Delete Catalog Variant
# Delete a catalog item variant with the given variant ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String] The catalog variant ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_catalog_variant_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.delete_catalog_variant ...'
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 CatalogsApi.delete_catalog_variant"
end
# resource path
local_var_path = '/api/catalog-variants/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.delete_catalog_variant",
:header_params => header_params,
:query_params => query_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: CatalogsApi#delete_catalog_variant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Bulk Create Catalog Items Job
# Get a catalog item bulk create job with the given job ID. An `include` parameter can be provided to get the following related resource data: `items`.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item_bulk_create_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Hash]
def get_bulk_create_catalog_items_job(job_id, opts = {})
data, _status_code, _headers = get_bulk_create_catalog_items_job_with_http_info(job_id, opts)
data
end
# alias of `get_bulk_create_catalog_items_job`
alias get_create_items_job get_bulk_create_catalog_items_job
# alias of `get_bulk_create_catalog_items_job`
alias get_catalog_item_bulk_create_job get_bulk_create_catalog_items_job
# Get Bulk Create Catalog Items Job
# Get a catalog item bulk create job with the given job ID. An `include` parameter can be provided to get the following related resource data: `items`.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item_bulk_create_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_bulk_create_catalog_items_job_with_http_info(job_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_bulk_create_catalog_items_job ...'
end
# verify the required parameter 'job_id' is set
if @api_client.config.client_side_validation && job_id.nil?
fail ArgumentError, "Missing the required parameter 'job_id' when calling CatalogsApi.get_bulk_create_catalog_items_job"
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_item_bulk_create_job'] && !opts[:'fields_catalog_item_bulk_create_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_item_bulk_create_job\", must include one of #{allowable_values}"
end
allowable_values = ["external_id", "title", "description", "price", "url", "image_full_url", "image_thumbnail_url", "images", "custom_metadata", "published", "created", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_item'] && !opts[:'fields_catalog_item'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_item\", must include one of #{allowable_values}"
end
allowable_values = ["items"]
if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-item-bulk-create-jobs/{job_id}'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-item-bulk-create-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_item_bulk_create_job'], :csv) if !opts[:'fields_catalog_item_bulk_create_job'].nil?
query_params[:'fields[catalog-item]'] = @api_client.build_collection_param(opts[:'fields_catalog_item'], :csv) if !opts[:'fields_catalog_item'].nil?
query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_bulk_create_catalog_items_job",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_bulk_create_catalog_items_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_bulk_create_catalog_items_job_with_http_info`
alias get_create_items_job_with_http_info get_bulk_create_catalog_items_job_with_http_info
# alias of `get_bulk_create_catalog_items_job_with_http_info`
alias get_catalog_item_bulk_create_job_with_http_info get_bulk_create_catalog_items_job_with_http_info
# Get Bulk Create Catalog Items Jobs
# Get all catalog item bulk create jobs. Returns a maximum of 100 jobs per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item_bulk_create_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Hash]
def get_bulk_create_catalog_items_jobs(opts = {})
data, _status_code, _headers = get_bulk_create_catalog_items_jobs_with_http_info(opts)
data
end
# alias of `get_bulk_create_catalog_items_jobs`
alias get_create_items_jobs get_bulk_create_catalog_items_jobs
# alias of `get_bulk_create_catalog_items_jobs`
alias get_catalog_item_bulk_create_jobs get_bulk_create_catalog_items_jobs
# Get Bulk Create Catalog Items Jobs
# Get all catalog item bulk create jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item_bulk_create_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_bulk_create_catalog_items_jobs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_bulk_create_catalog_items_jobs ...'
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_item_bulk_create_job'] && !opts[:'fields_catalog_item_bulk_create_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_item_bulk_create_job\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-item-bulk-create-jobs'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-item-bulk-create-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_item_bulk_create_job'], :csv) if !opts[:'fields_catalog_item_bulk_create_job'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_bulk_create_catalog_items_jobs",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_bulk_create_catalog_items_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_bulk_create_catalog_items_jobs_with_http_info`
alias get_create_items_jobs_with_http_info get_bulk_create_catalog_items_jobs_with_http_info
# alias of `get_bulk_create_catalog_items_jobs_with_http_info`
alias get_catalog_item_bulk_create_jobs_with_http_info get_bulk_create_catalog_items_jobs_with_http_info
# Get Bulk Delete Catalog Items Job
# Get a catalog item bulk delete job with the given job ID.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item_bulk_delete_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @return [Hash]
def get_bulk_delete_catalog_items_job(job_id, opts = {})
data, _status_code, _headers = get_bulk_delete_catalog_items_job_with_http_info(job_id, opts)
data
end
# alias of `get_bulk_delete_catalog_items_job`
alias get_delete_items_job get_bulk_delete_catalog_items_job
# alias of `get_bulk_delete_catalog_items_job`
alias get_catalog_item_bulk_delete_job get_bulk_delete_catalog_items_job
# Get Bulk Delete Catalog Items Job
# Get a catalog item bulk delete job with the given job ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item_bulk_delete_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_bulk_delete_catalog_items_job_with_http_info(job_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_bulk_delete_catalog_items_job ...'
end
# verify the required parameter 'job_id' is set
if @api_client.config.client_side_validation && job_id.nil?
fail ArgumentError, "Missing the required parameter 'job_id' when calling CatalogsApi.get_bulk_delete_catalog_items_job"
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_item_bulk_delete_job'] && !opts[:'fields_catalog_item_bulk_delete_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_item_bulk_delete_job\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-item-bulk-delete-jobs/{job_id}'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-item-bulk-delete-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_item_bulk_delete_job'], :csv) if !opts[:'fields_catalog_item_bulk_delete_job'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_bulk_delete_catalog_items_job",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_bulk_delete_catalog_items_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_bulk_delete_catalog_items_job_with_http_info`
alias get_delete_items_job_with_http_info get_bulk_delete_catalog_items_job_with_http_info
# alias of `get_bulk_delete_catalog_items_job_with_http_info`
alias get_catalog_item_bulk_delete_job_with_http_info get_bulk_delete_catalog_items_job_with_http_info
# Get Bulk Delete Catalog Items Jobs
# Get all catalog item bulk delete jobs. Returns a maximum of 100 jobs per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item_bulk_delete_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Hash]
def get_bulk_delete_catalog_items_jobs(opts = {})
data, _status_code, _headers = get_bulk_delete_catalog_items_jobs_with_http_info(opts)
data
end
# alias of `get_bulk_delete_catalog_items_jobs`
alias get_delete_items_jobs get_bulk_delete_catalog_items_jobs
# alias of `get_bulk_delete_catalog_items_jobs`
alias get_catalog_item_bulk_delete_jobs get_bulk_delete_catalog_items_jobs
# Get Bulk Delete Catalog Items Jobs
# Get all catalog item bulk delete jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item_bulk_delete_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_bulk_delete_catalog_items_jobs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_bulk_delete_catalog_items_jobs ...'
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_item_bulk_delete_job'] && !opts[:'fields_catalog_item_bulk_delete_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_item_bulk_delete_job\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-item-bulk-delete-jobs'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-item-bulk-delete-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_item_bulk_delete_job'], :csv) if !opts[:'fields_catalog_item_bulk_delete_job'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_bulk_delete_catalog_items_jobs",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_bulk_delete_catalog_items_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_bulk_delete_catalog_items_jobs_with_http_info`
alias get_delete_items_jobs_with_http_info get_bulk_delete_catalog_items_jobs_with_http_info
# alias of `get_bulk_delete_catalog_items_jobs_with_http_info`
alias get_catalog_item_bulk_delete_jobs_with_http_info get_bulk_delete_catalog_items_jobs_with_http_info
# Get Bulk Update Catalog Items Job
# Get a catalog item bulk update job with the given job ID. An `include` parameter can be provided to get the following related resource data: `items`.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item_bulk_update_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Hash]
def get_bulk_update_catalog_items_job(job_id, opts = {})
data, _status_code, _headers = get_bulk_update_catalog_items_job_with_http_info(job_id, opts)
data
end
# alias of `get_bulk_update_catalog_items_job`
alias get_update_items_job get_bulk_update_catalog_items_job
# alias of `get_bulk_update_catalog_items_job`
alias get_catalog_item_bulk_update_job get_bulk_update_catalog_items_job
# Get Bulk Update Catalog Items Job
# Get a catalog item bulk update job with the given job ID. An `include` parameter can be provided to get the following related resource data: `items`.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item_bulk_update_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_bulk_update_catalog_items_job_with_http_info(job_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_bulk_update_catalog_items_job ...'
end
# verify the required parameter 'job_id' is set
if @api_client.config.client_side_validation && job_id.nil?
fail ArgumentError, "Missing the required parameter 'job_id' when calling CatalogsApi.get_bulk_update_catalog_items_job"
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_item_bulk_update_job'] && !opts[:'fields_catalog_item_bulk_update_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_item_bulk_update_job\", must include one of #{allowable_values}"
end
allowable_values = ["external_id", "title", "description", "price", "url", "image_full_url", "image_thumbnail_url", "images", "custom_metadata", "published", "created", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_item'] && !opts[:'fields_catalog_item'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_item\", must include one of #{allowable_values}"
end
allowable_values = ["items"]
if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-item-bulk-update-jobs/{job_id}'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-item-bulk-update-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_item_bulk_update_job'], :csv) if !opts[:'fields_catalog_item_bulk_update_job'].nil?
query_params[:'fields[catalog-item]'] = @api_client.build_collection_param(opts[:'fields_catalog_item'], :csv) if !opts[:'fields_catalog_item'].nil?
query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_bulk_update_catalog_items_job",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_bulk_update_catalog_items_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_bulk_update_catalog_items_job_with_http_info`
alias get_update_items_job_with_http_info get_bulk_update_catalog_items_job_with_http_info
# alias of `get_bulk_update_catalog_items_job_with_http_info`
alias get_catalog_item_bulk_update_job_with_http_info get_bulk_update_catalog_items_job_with_http_info
# Get Bulk Update Catalog Items Jobs
# Get all catalog item bulk update jobs. Returns a maximum of 100 jobs per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item_bulk_update_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Hash]
def get_bulk_update_catalog_items_jobs(opts = {})
data, _status_code, _headers = get_bulk_update_catalog_items_jobs_with_http_info(opts)
data
end
# alias of `get_bulk_update_catalog_items_jobs`
alias get_update_items_jobs get_bulk_update_catalog_items_jobs
# alias of `get_bulk_update_catalog_items_jobs`
alias get_catalog_item_bulk_update_jobs get_bulk_update_catalog_items_jobs
# Get Bulk Update Catalog Items Jobs
# Get all catalog item bulk update jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item_bulk_update_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_bulk_update_catalog_items_jobs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_bulk_update_catalog_items_jobs ...'
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_item_bulk_update_job'] && !opts[:'fields_catalog_item_bulk_update_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_item_bulk_update_job\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-item-bulk-update-jobs'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-item-bulk-update-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_item_bulk_update_job'], :csv) if !opts[:'fields_catalog_item_bulk_update_job'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_bulk_update_catalog_items_jobs",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_bulk_update_catalog_items_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_bulk_update_catalog_items_jobs_with_http_info`
alias get_update_items_jobs_with_http_info get_bulk_update_catalog_items_jobs_with_http_info
# alias of `get_bulk_update_catalog_items_jobs_with_http_info`
alias get_catalog_item_bulk_update_jobs_with_http_info get_bulk_update_catalog_items_jobs_with_http_info
# Get Catalog Categories
# Get all catalog categories in an account. Catalog categories can be sorted by the following fields, in ascending and descending order: `created` Currently, the only supported integration type is `$custom`, and the only supported catalog type is `$default`. Returns a maximum of 100 categories per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`item.id`: `equals`<br>`name`: `contains`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Hash]
def get_catalog_categories(opts = {})
data, _status_code, _headers = get_catalog_categories_with_http_info(opts)
data
end
# Get Catalog Categories
# Get all catalog categories in an account. Catalog categories can be sorted by the following fields, in ascending and descending order: `created` Currently, the only supported integration type is `$custom`, and the only supported catalog type is `$default`. Returns a maximum of 100 categories per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`item.id`: `equals`<br>`name`: `contains`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_catalog_categories_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_catalog_categories ...'
end
allowable_values = ["external_id", "name", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_category'] && !opts[:'fields_catalog_category'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_category\", must include one of #{allowable_values}"
end
allowable_values = ["created", "-created"]
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/catalog-categories'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-category]'] = @api_client.build_collection_param(opts[:'fields_catalog_category'], :csv) if !opts[:'fields_catalog_category'].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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_catalog_categories",
:header_params => header_params,
:query_params => query_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: CatalogsApi#get_catalog_categories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Catalog Category
# Get a catalog category with the given category ID.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog category ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @return [Hash]
def get_catalog_category(id, opts = {})
data, _status_code, _headers = get_catalog_category_with_http_info(id, opts)
data
end
# Get Catalog Category
# Get a catalog category with the given category ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog category ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_catalog_category_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_catalog_category ...'
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 CatalogsApi.get_catalog_category"
end
allowable_values = ["external_id", "name", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_category'] && !opts[:'fields_catalog_category'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_category\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-categories/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-category]'] = @api_client.build_collection_param(opts[:'fields_catalog_category'], :csv) if !opts[:'fields_catalog_category'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_catalog_category",
:header_params => header_params,
:query_params => query_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: CatalogsApi#get_catalog_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Catalog Item
# Get a specific catalog item with the given item ID.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Hash]
def get_catalog_item(id, opts = {})
data, _status_code, _headers = get_catalog_item_with_http_info(id, opts)
data
end
# Get Catalog Item
# Get a specific catalog item with the given item ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_catalog_item_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_catalog_item ...'
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 CatalogsApi.get_catalog_item"
end
allowable_values = ["external_id", "title", "description", "price", "url", "image_full_url", "image_thumbnail_url", "images", "custom_metadata", "published", "created", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_item'] && !opts[:'fields_catalog_item'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_item\", must include one of #{allowable_values}"
end
allowable_values = ["external_id", "title", "description", "sku", "inventory_policy", "inventory_quantity", "price", "url", "image_full_url", "image_thumbnail_url", "images", "custom_metadata", "published", "created", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant'] && !opts[:'fields_catalog_variant'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant\", must include one of #{allowable_values}"
end
allowable_values = ["variants"]
if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-items/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-item]'] = @api_client.build_collection_param(opts[:'fields_catalog_item'], :csv) if !opts[:'fields_catalog_item'].nil?
query_params[:'fields[catalog-variant]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant'], :csv) if !opts[:'fields_catalog_variant'].nil?
query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_catalog_item",
:header_params => header_params,
:query_params => query_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: CatalogsApi#get_catalog_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Catalog Items
# Get all catalog items in an account. Catalog items can be sorted by the following fields, in ascending and descending order: `created` Currently, the only supported integration type is `$custom`, and the only supported catalog type is `$default`. Returns a maximum of 100 items per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`category.id`: `equals`<br>`title`: `contains`<br>`published`: `equals`
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Hash]
def get_catalog_items(opts = {})
data, _status_code, _headers = get_catalog_items_with_http_info(opts)
data
end
# Get Catalog Items
# Get all catalog items in an account. Catalog items can be sorted by the following fields, in ascending and descending order: `created` Currently, the only supported integration type is `$custom`, and the only supported catalog type is `$default`. Returns a maximum of 100 items per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`category.id`: `equals`<br>`title`: `contains`<br>`published`: `equals`
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_catalog_items_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_catalog_items ...'
end
allowable_values = ["external_id", "title", "description", "price", "url", "image_full_url", "image_thumbnail_url", "images", "custom_metadata", "published", "created", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_item'] && !opts[:'fields_catalog_item'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_item\", must include one of #{allowable_values}"
end
allowable_values = ["external_id", "title", "description", "sku", "inventory_policy", "inventory_quantity", "price", "url", "image_full_url", "image_thumbnail_url", "images", "custom_metadata", "published", "created", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant'] && !opts[:'fields_catalog_variant'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant\", must include one of #{allowable_values}"
end
allowable_values = ["variants"]
if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
end
allowable_values = ["created", "-created"]
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/catalog-items'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-item]'] = @api_client.build_collection_param(opts[:'fields_catalog_item'], :csv) if !opts[:'fields_catalog_item'].nil?
query_params[:'fields[catalog-variant]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant'], :csv) if !opts[:'fields_catalog_variant'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_catalog_items",
:header_params => header_params,
:query_params => query_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: CatalogsApi#get_catalog_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Catalog Variant
# Get a catalog item variant with the given variant ID.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog variant ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @return [Hash]
def get_catalog_variant(id, opts = {})
data, _status_code, _headers = get_catalog_variant_with_http_info(id, opts)
data
end
# Get Catalog Variant
# Get a catalog item variant with the given variant ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog variant ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_catalog_variant_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_catalog_variant ...'
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 CatalogsApi.get_catalog_variant"
end
allowable_values = ["external_id", "title", "description", "sku", "inventory_policy", "inventory_quantity", "price", "url", "image_full_url", "image_thumbnail_url", "images", "custom_metadata", "published", "created", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant'] && !opts[:'fields_catalog_variant'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-variants/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-variant]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant'], :csv) if !opts[:'fields_catalog_variant'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_catalog_variant",
:header_params => header_params,
:query_params => query_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: CatalogsApi#get_catalog_variant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Catalog Variants
# Get all variants in an account. Variants can be sorted by the following fields, in ascending and descending order: `created` Currently, the only supported integration type is `$custom`, and the only supported catalog type is `$default`. Returns a maximum of 100 variants per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`item.id`: `equals`<br>`sku`: `equals`<br>`title`: `contains`<br>`published`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Hash]
def get_catalog_variants(opts = {})
data, _status_code, _headers = get_catalog_variants_with_http_info(opts)
data
end
# Get Catalog Variants
# Get all variants in an account. Variants can be sorted by the following fields, in ascending and descending order: `created` Currently, the only supported integration type is `$custom`, and the only supported catalog type is `$default`. Returns a maximum of 100 variants per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`item.id`: `equals`<br>`sku`: `equals`<br>`title`: `contains`<br>`published`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_catalog_variants_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_catalog_variants ...'
end
allowable_values = ["external_id", "title", "description", "sku", "inventory_policy", "inventory_quantity", "price", "url", "image_full_url", "image_thumbnail_url", "images", "custom_metadata", "published", "created", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant'] && !opts[:'fields_catalog_variant'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant\", must include one of #{allowable_values}"
end
allowable_values = ["created", "-created"]
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/catalog-variants'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-variant]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant'], :csv) if !opts[:'fields_catalog_variant'].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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_catalog_variants",
:header_params => header_params,
:query_params => query_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: CatalogsApi#get_catalog_variants\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Categories for Catalog Item
# Get all catalog categories that an item with the given item ID is in. Catalog categories can be sorted by the following fields, in ascending and descending order: `created` Returns a maximum of 100 categories per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`item.id`: `equals`<br>`name`: `contains`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Hash]
def get_categories_for_catalog_item(id, opts = {})
data, _status_code, _headers = get_categories_for_catalog_item_with_http_info(id, opts)
data
end
# alias of `get_categories_for_catalog_item`
alias get_catalog_item_categories get_categories_for_catalog_item
# Get Categories for Catalog Item
# Get all catalog categories that an item with the given item ID is in. Catalog categories can be sorted by the following fields, in ascending and descending order: `created` Returns a maximum of 100 categories per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`item.id`: `equals`<br>`name`: `contains`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_categories_for_catalog_item_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_categories_for_catalog_item ...'
end
allowable_values = ["external_id", "name", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_category'] && !opts[:'fields_catalog_category'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_category\", must include one of #{allowable_values}"
end
allowable_values = ["created", "-created"]
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/catalog-items/{id}/categories'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-category]'] = @api_client.build_collection_param(opts[:'fields_catalog_category'], :csv) if !opts[:'fields_catalog_category'].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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_categories_for_catalog_item",
:header_params => header_params,
:query_params => query_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: CatalogsApi#get_categories_for_catalog_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_categories_for_catalog_item_with_http_info`
alias get_catalog_item_categories_with_http_info get_categories_for_catalog_item_with_http_info
# Get Category IDs for Catalog Item
# Get all catalog categories that a particular item is in. Returns a maximum of 100 categories per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`item.id`: `equals`<br>`name`: `contains`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Hash]
def get_category_ids_for_catalog_item(id, opts = {})
data, _status_code, _headers = get_category_ids_for_catalog_item_with_http_info(id, opts)
data
end
# alias of `get_category_ids_for_catalog_item`
alias get_catalog_item_relationships_categories get_category_ids_for_catalog_item
# Get Category IDs for Catalog Item
# Get all catalog categories that a particular item is in. Returns a maximum of 100 categories per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`item.id`: `equals`<br>`name`: `contains`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_category_ids_for_catalog_item_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_category_ids_for_catalog_item ...'
end
allowable_values = ["created", "-created"]
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/catalog-items/{id}/relationships/categories'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_category_ids_for_catalog_item",
:header_params => header_params,
:query_params => query_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: CatalogsApi#get_category_ids_for_catalog_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_category_ids_for_catalog_item_with_http_info`
alias get_catalog_item_relationships_categories_with_http_info get_category_ids_for_catalog_item_with_http_info
# Get Create Categories Job
# Get a catalog category bulk create job with the given job ID. An `include` parameter can be provided to get the following related resource data: `categories`.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category_bulk_create_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Hash]
def get_create_categories_job(job_id, opts = {})
data, _status_code, _headers = get_create_categories_job_with_http_info(job_id, opts)
data
end
# alias of `get_create_categories_job`
alias get_catalog_category_bulk_create_job get_create_categories_job
# Get Create Categories Job
# Get a catalog category bulk create job with the given job ID. An `include` parameter can be provided to get the following related resource data: `categories`.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category_bulk_create_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_create_categories_job_with_http_info(job_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_create_categories_job ...'
end
# verify the required parameter 'job_id' is set
if @api_client.config.client_side_validation && job_id.nil?
fail ArgumentError, "Missing the required parameter 'job_id' when calling CatalogsApi.get_create_categories_job"
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_category_bulk_create_job'] && !opts[:'fields_catalog_category_bulk_create_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_category_bulk_create_job\", must include one of #{allowable_values}"
end
allowable_values = ["external_id", "name", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_category'] && !opts[:'fields_catalog_category'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_category\", must include one of #{allowable_values}"
end
allowable_values = ["categories"]
if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-category-bulk-create-jobs/{job_id}'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-category-bulk-create-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_category_bulk_create_job'], :csv) if !opts[:'fields_catalog_category_bulk_create_job'].nil?
query_params[:'fields[catalog-category]'] = @api_client.build_collection_param(opts[:'fields_catalog_category'], :csv) if !opts[:'fields_catalog_category'].nil?
query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_create_categories_job",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_create_categories_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_create_categories_job_with_http_info`
alias get_catalog_category_bulk_create_job_with_http_info get_create_categories_job_with_http_info
# Get Create Categories Jobs
# Get all catalog category bulk create jobs. Returns a maximum of 100 jobs per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category_bulk_create_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Hash]
def get_create_categories_jobs(opts = {})
data, _status_code, _headers = get_create_categories_jobs_with_http_info(opts)
data
end
# alias of `get_create_categories_jobs`
alias get_catalog_category_bulk_create_jobs get_create_categories_jobs
# Get Create Categories Jobs
# Get all catalog category bulk create jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category_bulk_create_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_create_categories_jobs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_create_categories_jobs ...'
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_category_bulk_create_job'] && !opts[:'fields_catalog_category_bulk_create_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_category_bulk_create_job\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-category-bulk-create-jobs'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-category-bulk-create-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_category_bulk_create_job'], :csv) if !opts[:'fields_catalog_category_bulk_create_job'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_create_categories_jobs",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_create_categories_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_create_categories_jobs_with_http_info`
alias get_catalog_category_bulk_create_jobs_with_http_info get_create_categories_jobs_with_http_info
# Get Create Variants Job
# Get a catalog variant bulk create job with the given job ID. An `include` parameter can be provided to get the following related resource data: `variants`.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant_bulk_create_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Hash]
def get_create_variants_job(job_id, opts = {})
data, _status_code, _headers = get_create_variants_job_with_http_info(job_id, opts)
data
end
# alias of `get_create_variants_job`
alias get_catalog_variant_bulk_create_job get_create_variants_job
# Get Create Variants Job
# Get a catalog variant bulk create job with the given job ID. An `include` parameter can be provided to get the following related resource data: `variants`.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant_bulk_create_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_create_variants_job_with_http_info(job_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_create_variants_job ...'
end
# verify the required parameter 'job_id' is set
if @api_client.config.client_side_validation && job_id.nil?
fail ArgumentError, "Missing the required parameter 'job_id' when calling CatalogsApi.get_create_variants_job"
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant_bulk_create_job'] && !opts[:'fields_catalog_variant_bulk_create_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant_bulk_create_job\", must include one of #{allowable_values}"
end
allowable_values = ["external_id", "title", "description", "sku", "inventory_policy", "inventory_quantity", "price", "url", "image_full_url", "image_thumbnail_url", "images", "custom_metadata", "published", "created", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant'] && !opts[:'fields_catalog_variant'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant\", must include one of #{allowable_values}"
end
allowable_values = ["variants"]
if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-variant-bulk-create-jobs/{job_id}'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-variant-bulk-create-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant_bulk_create_job'], :csv) if !opts[:'fields_catalog_variant_bulk_create_job'].nil?
query_params[:'fields[catalog-variant]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant'], :csv) if !opts[:'fields_catalog_variant'].nil?
query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_create_variants_job",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_create_variants_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_create_variants_job_with_http_info`
alias get_catalog_variant_bulk_create_job_with_http_info get_create_variants_job_with_http_info
# Get Create Variants Jobs
# Get all catalog variant bulk create jobs. Returns a maximum of 100 jobs per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant_bulk_create_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Hash]
def get_create_variants_jobs(opts = {})
data, _status_code, _headers = get_create_variants_jobs_with_http_info(opts)
data
end
# alias of `get_create_variants_jobs`
alias get_catalog_variant_bulk_create_jobs get_create_variants_jobs
# Get Create Variants Jobs
# Get all catalog variant bulk create jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant_bulk_create_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_create_variants_jobs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_create_variants_jobs ...'
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant_bulk_create_job'] && !opts[:'fields_catalog_variant_bulk_create_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant_bulk_create_job\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-variant-bulk-create-jobs'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-variant-bulk-create-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant_bulk_create_job'], :csv) if !opts[:'fields_catalog_variant_bulk_create_job'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_create_variants_jobs",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_create_variants_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_create_variants_jobs_with_http_info`
alias get_catalog_variant_bulk_create_jobs_with_http_info get_create_variants_jobs_with_http_info
# Get Delete Categories Job
# Get a catalog category bulk delete job with the given job ID.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category_bulk_delete_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @return [Hash]
def get_delete_categories_job(job_id, opts = {})
data, _status_code, _headers = get_delete_categories_job_with_http_info(job_id, opts)
data
end
# alias of `get_delete_categories_job`
alias get_catalog_category_bulk_delete_job get_delete_categories_job
# Get Delete Categories Job
# Get a catalog category bulk delete job with the given job ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category_bulk_delete_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_delete_categories_job_with_http_info(job_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_delete_categories_job ...'
end
# verify the required parameter 'job_id' is set
if @api_client.config.client_side_validation && job_id.nil?
fail ArgumentError, "Missing the required parameter 'job_id' when calling CatalogsApi.get_delete_categories_job"
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_category_bulk_delete_job'] && !opts[:'fields_catalog_category_bulk_delete_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_category_bulk_delete_job\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-category-bulk-delete-jobs/{job_id}'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-category-bulk-delete-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_category_bulk_delete_job'], :csv) if !opts[:'fields_catalog_category_bulk_delete_job'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_delete_categories_job",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_delete_categories_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_delete_categories_job_with_http_info`
alias get_catalog_category_bulk_delete_job_with_http_info get_delete_categories_job_with_http_info
# Get Delete Categories Jobs
# Get all catalog category bulk delete jobs. Returns a maximum of 100 jobs per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category_bulk_delete_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Hash]
def get_delete_categories_jobs(opts = {})
data, _status_code, _headers = get_delete_categories_jobs_with_http_info(opts)
data
end
# alias of `get_delete_categories_jobs`
alias get_catalog_category_bulk_delete_jobs get_delete_categories_jobs
# Get Delete Categories Jobs
# Get all catalog category bulk delete jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category_bulk_delete_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_delete_categories_jobs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_delete_categories_jobs ...'
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_category_bulk_delete_job'] && !opts[:'fields_catalog_category_bulk_delete_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_category_bulk_delete_job\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-category-bulk-delete-jobs'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-category-bulk-delete-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_category_bulk_delete_job'], :csv) if !opts[:'fields_catalog_category_bulk_delete_job'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_delete_categories_jobs",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_delete_categories_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_delete_categories_jobs_with_http_info`
alias get_catalog_category_bulk_delete_jobs_with_http_info get_delete_categories_jobs_with_http_info
# Get Delete Variants Job
# Get a catalog variant bulk delete job with the given job ID.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant_bulk_delete_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @return [Hash]
def get_delete_variants_job(job_id, opts = {})
data, _status_code, _headers = get_delete_variants_job_with_http_info(job_id, opts)
data
end
# alias of `get_delete_variants_job`
alias get_catalog_variant_bulk_delete_job get_delete_variants_job
# Get Delete Variants Job
# Get a catalog variant bulk delete job with the given job ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant_bulk_delete_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_delete_variants_job_with_http_info(job_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_delete_variants_job ...'
end
# verify the required parameter 'job_id' is set
if @api_client.config.client_side_validation && job_id.nil?
fail ArgumentError, "Missing the required parameter 'job_id' when calling CatalogsApi.get_delete_variants_job"
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant_bulk_delete_job'] && !opts[:'fields_catalog_variant_bulk_delete_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant_bulk_delete_job\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-variant-bulk-delete-jobs/{job_id}'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-variant-bulk-delete-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant_bulk_delete_job'], :csv) if !opts[:'fields_catalog_variant_bulk_delete_job'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_delete_variants_job",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_delete_variants_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_delete_variants_job_with_http_info`
alias get_catalog_variant_bulk_delete_job_with_http_info get_delete_variants_job_with_http_info
# Get Delete Variants Jobs
# Get all catalog variant bulk delete jobs. Returns a maximum of 100 jobs per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant_bulk_delete_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Hash]
def get_delete_variants_jobs(opts = {})
data, _status_code, _headers = get_delete_variants_jobs_with_http_info(opts)
data
end
# alias of `get_delete_variants_jobs`
alias get_catalog_variant_bulk_delete_jobs get_delete_variants_jobs
# Get Delete Variants Jobs
# Get all catalog variant bulk delete jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant_bulk_delete_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_delete_variants_jobs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_delete_variants_jobs ...'
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant_bulk_delete_job'] && !opts[:'fields_catalog_variant_bulk_delete_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant_bulk_delete_job\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-variant-bulk-delete-jobs'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-variant-bulk-delete-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant_bulk_delete_job'], :csv) if !opts[:'fields_catalog_variant_bulk_delete_job'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_delete_variants_jobs",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_delete_variants_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_delete_variants_jobs_with_http_info`
alias get_catalog_variant_bulk_delete_jobs_with_http_info get_delete_variants_jobs_with_http_info
# Get Item IDs for Catalog Category
# Get all items in the given category ID. Returns a maximum of 100 items per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog category ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`category.id`: `equals`<br>`title`: `contains`<br>`published`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Hash]
def get_item_ids_for_catalog_category(id, opts = {})
data, _status_code, _headers = get_item_ids_for_catalog_category_with_http_info(id, opts)
data
end
# alias of `get_item_ids_for_catalog_category`
alias get_catalog_category_relationships_items get_item_ids_for_catalog_category
# Get Item IDs for Catalog Category
# Get all items in the given category ID. Returns a maximum of 100 items per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog category ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`category.id`: `equals`<br>`title`: `contains`<br>`published`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_item_ids_for_catalog_category_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_item_ids_for_catalog_category ...'
end
allowable_values = ["created", "-created"]
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/catalog-categories/{id}/relationships/items'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_item_ids_for_catalog_category",
:header_params => header_params,
:query_params => query_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: CatalogsApi#get_item_ids_for_catalog_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_item_ids_for_catalog_category_with_http_info`
alias get_catalog_category_relationships_items_with_http_info get_item_ids_for_catalog_category_with_http_info
# Get Items for Catalog Category
# Get all items in a category with the given category ID. Items can be sorted by the following fields, in ascending and descending order: `created` Returns a maximum of 100 items per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog category ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`category.id`: `equals`<br>`title`: `contains`<br>`published`: `equals`
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Hash]
def get_items_for_catalog_category(id, opts = {})
data, _status_code, _headers = get_items_for_catalog_category_with_http_info(id, opts)
data
end
# alias of `get_items_for_catalog_category`
alias get_catalog_category_items get_items_for_catalog_category
# Get Items for Catalog Category
# Get all items in a category with the given category ID. Items can be sorted by the following fields, in ascending and descending order: `created` Returns a maximum of 100 items per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog category ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`category.id`: `equals`<br>`title`: `contains`<br>`published`: `equals`
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_items_for_catalog_category_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_items_for_catalog_category ...'
end
allowable_values = ["external_id", "title", "description", "price", "url", "image_full_url", "image_thumbnail_url", "images", "custom_metadata", "published", "created", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_item'] && !opts[:'fields_catalog_item'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_item\", must include one of #{allowable_values}"
end
allowable_values = ["external_id", "title", "description", "sku", "inventory_policy", "inventory_quantity", "price", "url", "image_full_url", "image_thumbnail_url", "images", "custom_metadata", "published", "created", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant'] && !opts[:'fields_catalog_variant'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant\", must include one of #{allowable_values}"
end
allowable_values = ["variants"]
if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
end
allowable_values = ["created", "-created"]
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/catalog-categories/{id}/items'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-item]'] = @api_client.build_collection_param(opts[:'fields_catalog_item'], :csv) if !opts[:'fields_catalog_item'].nil?
query_params[:'fields[catalog-variant]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant'], :csv) if !opts[:'fields_catalog_variant'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_items_for_catalog_category",
:header_params => header_params,
:query_params => query_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: CatalogsApi#get_items_for_catalog_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_items_for_catalog_category_with_http_info`
alias get_catalog_category_items_with_http_info get_items_for_catalog_category_with_http_info
# Get Update Categories Job
# Get a catalog category bulk update job with the given job ID. An `include` parameter can be provided to get the following related resource data: `categories`.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category_bulk_update_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Hash]
def get_update_categories_job(job_id, opts = {})
data, _status_code, _headers = get_update_categories_job_with_http_info(job_id, opts)
data
end
# alias of `get_update_categories_job`
alias get_catalog_category_bulk_update_job get_update_categories_job
# Get Update Categories Job
# Get a catalog category bulk update job with the given job ID. An `include` parameter can be provided to get the following related resource data: `categories`.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category_bulk_update_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_update_categories_job_with_http_info(job_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_update_categories_job ...'
end
# verify the required parameter 'job_id' is set
if @api_client.config.client_side_validation && job_id.nil?
fail ArgumentError, "Missing the required parameter 'job_id' when calling CatalogsApi.get_update_categories_job"
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_category_bulk_update_job'] && !opts[:'fields_catalog_category_bulk_update_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_category_bulk_update_job\", must include one of #{allowable_values}"
end
allowable_values = ["external_id", "name", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_category'] && !opts[:'fields_catalog_category'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_category\", must include one of #{allowable_values}"
end
allowable_values = ["categories"]
if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-category-bulk-update-jobs/{job_id}'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-category-bulk-update-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_category_bulk_update_job'], :csv) if !opts[:'fields_catalog_category_bulk_update_job'].nil?
query_params[:'fields[catalog-category]'] = @api_client.build_collection_param(opts[:'fields_catalog_category'], :csv) if !opts[:'fields_catalog_category'].nil?
query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_update_categories_job",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_update_categories_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_update_categories_job_with_http_info`
alias get_catalog_category_bulk_update_job_with_http_info get_update_categories_job_with_http_info
# Get Update Categories Jobs
# Get all catalog category bulk update jobs. Returns a maximum of 100 jobs per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category_bulk_update_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Hash]
def get_update_categories_jobs(opts = {})
data, _status_code, _headers = get_update_categories_jobs_with_http_info(opts)
data
end
# alias of `get_update_categories_jobs`
alias get_catalog_category_bulk_update_jobs get_update_categories_jobs
# Get Update Categories Jobs
# Get all catalog category bulk update jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category_bulk_update_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_update_categories_jobs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_update_categories_jobs ...'
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_category_bulk_update_job'] && !opts[:'fields_catalog_category_bulk_update_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_category_bulk_update_job\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-category-bulk-update-jobs'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-category-bulk-update-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_category_bulk_update_job'], :csv) if !opts[:'fields_catalog_category_bulk_update_job'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_update_categories_jobs",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_update_categories_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_update_categories_jobs_with_http_info`
alias get_catalog_category_bulk_update_jobs_with_http_info get_update_categories_jobs_with_http_info
# Get Update Variants Job
# Get a catalog variate bulk update job with the given job ID. An `include` parameter can be provided to get the following related resource data: `variants`.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant_bulk_update_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Hash]
def get_update_variants_job(job_id, opts = {})
data, _status_code, _headers = get_update_variants_job_with_http_info(job_id, opts)
data
end
# alias of `get_update_variants_job`
alias get_catalog_variant_bulk_update_job get_update_variants_job
# Get Update Variants Job
# Get a catalog variate bulk update job with the given job ID. An `include` parameter can be provided to get the following related resource data: `variants`.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param job_id [String] ID of the job to retrieve.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant_bulk_update_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#relationships
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_update_variants_job_with_http_info(job_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_update_variants_job ...'
end
# verify the required parameter 'job_id' is set
if @api_client.config.client_side_validation && job_id.nil?
fail ArgumentError, "Missing the required parameter 'job_id' when calling CatalogsApi.get_update_variants_job"
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant_bulk_update_job'] && !opts[:'fields_catalog_variant_bulk_update_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant_bulk_update_job\", must include one of #{allowable_values}"
end
allowable_values = ["external_id", "title", "description", "sku", "inventory_policy", "inventory_quantity", "price", "url", "image_full_url", "image_thumbnail_url", "images", "custom_metadata", "published", "created", "updated"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant'] && !opts[:'fields_catalog_variant'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant\", must include one of #{allowable_values}"
end
allowable_values = ["variants"]
if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-variant-bulk-update-jobs/{job_id}'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-variant-bulk-update-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant_bulk_update_job'], :csv) if !opts[:'fields_catalog_variant_bulk_update_job'].nil?
query_params[:'fields[catalog-variant]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant'], :csv) if !opts[:'fields_catalog_variant'].nil?
query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_update_variants_job",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_update_variants_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_update_variants_job_with_http_info`
alias get_catalog_variant_bulk_update_job_with_http_info get_update_variants_job_with_http_info
# Get Update Variants Jobs
# Get all catalog variant bulk update jobs. Returns a maximum of 100 jobs per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant_bulk_update_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Hash]
def get_update_variants_jobs(opts = {})
data, _status_code, _headers = get_update_variants_jobs_with_http_info(opts)
data
end
# alias of `get_update_variants_jobs`
alias get_catalog_variant_bulk_update_jobs get_update_variants_jobs
# Get Update Variants Jobs
# Get all catalog variant bulk update jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant_bulk_update_job For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_update_variants_jobs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_update_variants_jobs ...'
end
allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "errors", "expires_at"]
if @api_client.config.client_side_validation && opts[:'fields_catalog_variant_bulk_update_job'] && !opts[:'fields_catalog_variant_bulk_update_job'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_catalog_variant_bulk_update_job\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/catalog-variant-bulk-update-jobs'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[catalog-variant-bulk-update-job]'] = @api_client.build_collection_param(opts[:'fields_catalog_variant_bulk_update_job'], :csv) if !opts[:'fields_catalog_variant_bulk_update_job'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_update_variants_jobs",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#get_update_variants_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_update_variants_jobs_with_http_info`
alias get_catalog_variant_bulk_update_jobs_with_http_info get_update_variants_jobs_with_http_info
# Get Variant IDs for Catalog Item
# Get all variants related to the given item ID. Variants can be sorted by the following fields, in ascending and descending order: `created` Returns a maximum of 100 variants per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`item.id`: `equals`<br>`sku`: `equals`<br>`title`: `contains`<br>`published`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Hash]
def get_variant_ids_for_catalog_item(id, opts = {})
data, _status_code, _headers = get_variant_ids_for_catalog_item_with_http_info(id, opts)
data
end
# alias of `get_variant_ids_for_catalog_item`
alias get_catalog_item_relationships_variants get_variant_ids_for_catalog_item
# Get Variant IDs for Catalog Item
# Get all variants related to the given item ID. Variants can be sorted by the following fields, in ascending and descending order: `created` Returns a maximum of 100 variants per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`item.id`: `equals`<br>`sku`: `equals`<br>`title`: `contains`<br>`published`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_variant_ids_for_catalog_item_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_variant_ids_for_catalog_item ...'
end
allowable_values = ["created", "-created"]
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/catalog-items/{id}/relationships/variants'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+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', 'OAuth']
new_options = opts.merge(
:operation => :"CatalogsApi.get_variant_ids_for_catalog_item",
:header_params => header_params,
:query_params => query_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: CatalogsApi#get_variant_ids_for_catalog_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# alias of `get_variant_ids_for_catalog_item_with_http_info`
alias get_catalog_item_relationships_variants_with_http_info get_variant_ids_for_catalog_item_with_http_info
# Get Variants for Catalog Item
# Get all variants related to the given item ID. Variants can be sorted by the following fields, in ascending and descending order: `created` Returns a maximum of 100 variants per request.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`ids`: `any`<br>`item.id`: `equals`<br>`sku`: `equals`<br>`title`: `contains`<br>`published`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2025-01-15/reference/api-overview#sorting
# @return [Hash]
def get_variants_for_catalog_item(id, opts = {})
data, _status_code, _headers = get_variants_for_catalog_item_with_http_info(id, opts)
data
end
# alias of `get_variants_for_catalog_item`
alias get_catalog_item_variants get_variants_for_catalog_item
# Get Variants for Catalog Item
# Get all variants related to the given item ID. Variants can be sorted by the following fields, in ascending and descending order: `created` Returns a maximum of 100 variants per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
# @param id [String] The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
# @param [Hash] opts the optional parameters
# @option opts [Array