=begin
#Klaviyo API
#The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details.
The version of the OpenAPI document: 2023-12-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
# 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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(server_bis_subscription_create_query)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(catalog_category_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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 Category Relationships Items
# Create a new item relationship for the given category ID.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String]
# @param catalog_category_item_op [CatalogCategoryItemOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def create_catalog_category_relationships_items(id, catalog_category_item_op, opts = {})
create_catalog_category_relationships_items_with_http_info(id, catalog_category_item_op, opts)
nil
end
# Create Catalog Category Relationships Items
# 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]
# @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 create_catalog_category_relationships_items_with_http_info(id, catalog_category_item_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.create_catalog_category_relationships_items ...'
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.create_catalog_category_relationships_items"
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.create_catalog_category_relationships_items"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(catalog_category_item_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.create_catalog_category_relationships_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#create_catalog_category_relationships_items\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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(catalog_item_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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 Item Relationships Categories
# 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]
# @param catalog_item_category_op [CatalogItemCategoryOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def create_catalog_item_relationships_categories(id, catalog_item_category_op, opts = {})
create_catalog_item_relationships_categories_with_http_info(id, catalog_item_category_op, opts)
nil
end
# Create Catalog Item Relationships Categories
# 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]
# @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 create_catalog_item_relationships_categories_with_http_info(id, catalog_item_category_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.create_catalog_item_relationships_categories ...'
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.create_catalog_item_relationships_categories"
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.create_catalog_item_relationships_categories"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(catalog_item_category_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.create_catalog_item_relationships_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#create_catalog_item_relationships_categories\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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(catalog_variant_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
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 Category Relationships Items
# Delete item relationships for the given category ID.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String]
# @param catalog_category_item_op [CatalogCategoryItemOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_catalog_category_relationships_items(id, catalog_category_item_op, opts = {})
delete_catalog_category_relationships_items_with_http_info(id, catalog_category_item_op, opts)
nil
end
# Delete Catalog Category Relationships Items
# Delete item relationships for the given category ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String]
# @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 delete_catalog_category_relationships_items_with_http_info(id, catalog_category_item_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.delete_catalog_category_relationships_items ...'
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_relationships_items"
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.delete_catalog_category_relationships_items"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(catalog_category_item_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.delete_catalog_category_relationships_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(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#delete_catalog_category_relationships_items\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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
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 Item Relationships Categories
# Delete catalog category relationships for the given item ID.
*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String]
# @param catalog_item_category_op [CatalogItemCategoryOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_catalog_item_relationships_categories(id, catalog_item_category_op, opts = {})
delete_catalog_item_relationships_categories_with_http_info(id, catalog_item_category_op, opts)
nil
end
# Delete Catalog Item Relationships Categories
# Delete catalog category relationships for the given item ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `catalogs:write`
# @param id [String]
# @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 delete_catalog_item_relationships_categories_with_http_info(id, catalog_item_category_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.delete_catalog_item_relationships_categories ...'
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_relationships_categories"
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.delete_catalog_item_relationships_categories"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(catalog_item_category_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.delete_catalog_item_relationships_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(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#delete_catalog_item_relationships_categories\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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
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 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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/v2023-12-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/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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 Category Items
# 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]
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#relationships
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sorting
# @return [Hash]
def get_catalog_category_items(id, opts = {})
data, _status_code, _headers = get_catalog_category_items_with_http_info(id, opts)
data
end
# Get Catalog Category Items
# 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]
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#relationships
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_catalog_category_items_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_catalog_category_items ...'
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_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-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.get_catalog_category_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_category_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Catalog Category Relationships Items
# 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]
# @param [Hash] opts the optional parameters
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#pagination
# @return [Hash]
def get_catalog_category_relationships_items(id, opts = {})
data, _status_code, _headers = get_catalog_category_relationships_items_with_http_info(id, opts)
data
end
# Get Catalog Category Relationships Items
# 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]
# @param [Hash] opts the optional parameters
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_catalog_category_relationships_items_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_catalog_category_relationships_items ...'
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_relationships_items"
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[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.get_catalog_category_relationships_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_category_relationships_items\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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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 Item Categories
# 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]
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sorting
# @return [Hash]
def get_catalog_item_categories(id, opts = {})
data, _status_code, _headers = get_catalog_item_categories_with_http_info(id, opts)
data
end
# Get Catalog Item Categories
# 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]
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_catalog_item_categories_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_catalog_item_categories ...'
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_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-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.get_catalog_item_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_item_categories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Catalog Item Relationships Categories
# 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]
# @param [Hash] opts the optional parameters
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#pagination
# @return [Hash]
def get_catalog_item_relationships_categories(id, opts = {})
data, _status_code, _headers = get_catalog_item_relationships_categories_with_http_info(id, opts)
data
end
# Get Catalog Item Relationships Categories
# 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]
# @param [Hash] opts the optional parameters
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_catalog_item_relationships_categories_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_catalog_item_relationships_categories ...'
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_relationships_categories"
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[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.get_catalog_item_relationships_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_item_relationships_categories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Catalog Item Variants
# 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]
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sorting
# @return [Hash]
def get_catalog_item_variants(id, opts = {})
data, _status_code, _headers = get_catalog_item_variants_with_http_info(id, opts)
data
end
# Get Catalog Item Variants
# 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]
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_catalog_item_variants_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_catalog_item_variants ...'
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_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-items/{id}/variants/'.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?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.get_catalog_item_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_item_variants\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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#relationships
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#relationships
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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/v2023-12-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/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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
# Get Create 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#relationships
# @return [Hash]
def get_create_items_job(job_id, opts = {})
data, _status_code, _headers = get_create_items_job_with_http_info(job_id, opts)
data
end
# Get Create 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#relationships
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_create_items_job_with_http_info(job_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_create_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_create_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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.get_create_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_create_items_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Create 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @return [Hash]
def get_create_items_jobs(opts = {})
data, _status_code, _headers = get_create_items_jobs_with_http_info(opts)
data
end
# Get Create 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_create_items_jobs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_create_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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.get_create_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_create_items_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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
# 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/v2023-12-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
# 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/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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
# Get Delete 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @return [Hash]
def get_delete_items_job(job_id, opts = {})
data, _status_code, _headers = get_delete_items_job_with_http_info(job_id, opts)
data
end
# Get Delete 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_delete_items_job_with_http_info(job_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_delete_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_delete_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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.get_delete_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_delete_items_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Delete 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @return [Hash]
def get_delete_items_jobs(opts = {})
data, _status_code, _headers = get_delete_items_jobs_with_http_info(opts)
data
end
# Get Delete 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_delete_items_jobs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_delete_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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.get_delete_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_delete_items_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# 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/v2023-12-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
# 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/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_category For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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
# Get Update 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#relationships
# @return [Hash]
def get_update_items_job(job_id, opts = {})
data, _status_code, _headers = get_update_items_job_with_http_info(job_id, opts)
data
end
# Get Update 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_item For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#relationships
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_update_items_job_with_http_info(job_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_update_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_update_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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.get_update_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_update_items_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Update 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @return [Hash]
def get_update_items_jobs(opts = {})
data, _status_code, _headers = get_update_items_jobs_with_http_info(opts)
data
end
# Get Update 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-15/reference/api-overview#pagination
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_update_items_jobs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.get_update_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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"CatalogsApi.get_update_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_update_items_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :fields_catalog_variant For more information please visit https://developers.klaviyo.com/en/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-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
# 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/v2023-12-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-12-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/v2023-12-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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"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
# Spawn Create Categories Job
# 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.
*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 spawn_create_categories_job(catalog_category_create_job_create_query, opts = {})
data, _status_code, _headers = spawn_create_categories_job_with_http_info(catalog_category_create_job_create_query, opts)
data
end
# Spawn Create Categories Job
# 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.<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 spawn_create_categories_job_with_http_info(catalog_category_create_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.spawn_create_categories_job ...'
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.spawn_create_categories_job"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(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']
new_options = opts.merge(
:operation => :"CatalogsApi.spawn_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(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#spawn_create_categories_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Spawn Create Items Job
# 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.
*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 spawn_create_items_job(catalog_item_create_job_create_query, opts = {})
data, _status_code, _headers = spawn_create_items_job_with_http_info(catalog_item_create_job_create_query, opts)
data
end
# Spawn Create Items Job
# 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.<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 spawn_create_items_job_with_http_info(catalog_item_create_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.spawn_create_items_job ...'
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.spawn_create_items_job"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(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']
new_options = opts.merge(
:operation => :"CatalogsApi.spawn_create_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(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#spawn_create_items_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Spawn Create Variants Job
# 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.
*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 spawn_create_variants_job(catalog_variant_create_job_create_query, opts = {})
data, _status_code, _headers = spawn_create_variants_job_with_http_info(catalog_variant_create_job_create_query, opts)
data
end
# Spawn Create Variants Job
# 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.<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 spawn_create_variants_job_with_http_info(catalog_variant_create_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.spawn_create_variants_job ...'
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.spawn_create_variants_job"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(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']
new_options = opts.merge(
:operation => :"CatalogsApi.spawn_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(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#spawn_create_variants_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Spawn Delete Categories Job
# 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.
*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 spawn_delete_categories_job(catalog_category_delete_job_create_query, opts = {})
data, _status_code, _headers = spawn_delete_categories_job_with_http_info(catalog_category_delete_job_create_query, opts)
data
end
# Spawn Delete Categories Job
# 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.<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 spawn_delete_categories_job_with_http_info(catalog_category_delete_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.spawn_delete_categories_job ...'
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.spawn_delete_categories_job"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(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']
new_options = opts.merge(
:operation => :"CatalogsApi.spawn_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(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#spawn_delete_categories_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Spawn Delete Items Job
# 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.
*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 spawn_delete_items_job(catalog_item_delete_job_create_query, opts = {})
data, _status_code, _headers = spawn_delete_items_job_with_http_info(catalog_item_delete_job_create_query, opts)
data
end
# Spawn Delete Items Job
# 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.<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 spawn_delete_items_job_with_http_info(catalog_item_delete_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.spawn_delete_items_job ...'
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.spawn_delete_items_job"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(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']
new_options = opts.merge(
:operation => :"CatalogsApi.spawn_delete_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(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#spawn_delete_items_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Spawn Delete Variants Job
# 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.
*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 spawn_delete_variants_job(catalog_variant_delete_job_create_query, opts = {})
data, _status_code, _headers = spawn_delete_variants_job_with_http_info(catalog_variant_delete_job_create_query, opts)
data
end
# Spawn Delete Variants Job
# 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.<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 spawn_delete_variants_job_with_http_info(catalog_variant_delete_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.spawn_delete_variants_job ...'
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.spawn_delete_variants_job"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(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']
new_options = opts.merge(
:operation => :"CatalogsApi.spawn_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(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#spawn_delete_variants_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Spawn Update Categories Job
# 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.
*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 spawn_update_categories_job(catalog_category_update_job_create_query, opts = {})
data, _status_code, _headers = spawn_update_categories_job_with_http_info(catalog_category_update_job_create_query, opts)
data
end
# Spawn Update Categories Job
# 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.<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 spawn_update_categories_job_with_http_info(catalog_category_update_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.spawn_update_categories_job ...'
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.spawn_update_categories_job"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(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']
new_options = opts.merge(
:operation => :"CatalogsApi.spawn_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(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#spawn_update_categories_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Spawn Update Items Job
# 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.
*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 spawn_update_items_job(catalog_item_update_job_create_query, opts = {})
data, _status_code, _headers = spawn_update_items_job_with_http_info(catalog_item_update_job_create_query, opts)
data
end
# Spawn Update Items Job
# 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.<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 spawn_update_items_job_with_http_info(catalog_item_update_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.spawn_update_items_job ...'
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.spawn_update_items_job"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(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']
new_options = opts.merge(
:operation => :"CatalogsApi.spawn_update_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(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#spawn_update_items_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Spawn Update Variants Job
# 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.
*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 spawn_update_variants_job(catalog_variant_update_job_create_query, opts = {})
data, _status_code, _headers = spawn_update_variants_job_with_http_info(catalog_variant_update_job_create_query, opts)
data
end
# Spawn Update Variants Job
# 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.<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 spawn_update_variants_job_with_http_info(catalog_variant_update_job_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CatalogsApi.spawn_update_variants_job ...'
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.spawn_update_variants_job"
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['API_REVISION'] || "2023-12-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(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']
new_options = opts.merge(
:operation => :"CatalogsApi.spawn_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(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CatalogsApi#spawn_update_variants_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update Catalog Category
# Update a catalog category with the given category ID.