Method: KlaviyoAPI::TemplatesApi#get_universal_content_with_http_info

Defined in:
lib/klaviyo-api-sdk/api/templates_api.rb

#get_universal_content_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Universal Content Get the universal content with the given ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;10/s&#x60;&lt;br&gt;Steady: &#x60;150/m&#x60; Scopes: &#x60;templates:read&#x60;

Parameters:

  • id (String)

    The ID of the universal content

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
# File 'lib/klaviyo-api-sdk/api/templates_api.rb', line 643

def get_universal_content_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.get_universal_content ...'
  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 TemplatesApi.get_universal_content"
  end
  allowable_values = ["name", "definition", "definition.content_type", "definition.type", "definition.data", "definition.data.content", "definition.data.display_options", "definition.data.display_options.show_on", "definition.data.display_options.visible_check", "definition.data.display_options.content_repeat", "definition.data.display_options.content_repeat.repeat_for", "definition.data.display_options.content_repeat.item_alias", "definition.data.styles", "definition.data.styles.background_color", "definition.data.styles.block_background_color", "definition.data.styles.block_border_color", "definition.data.styles.block_border_style", "definition.data.styles.block_border_width", "definition.data.styles.block_padding_bottom", "definition.data.styles.block_padding_left", "definition.data.styles.block_padding_right", "definition.data.styles.block_padding_top", "definition.data.styles.color", "definition.data.styles.extra_css_class", "definition.data.styles.font_family", "definition.data.styles.font_size", "definition.data.styles.font_style", "definition.data.styles.font_weight", "definition.data.styles.inner_padding_bottom", "definition.data.styles.inner_padding_left", "definition.data.styles.inner_padding_right", "definition.data.styles.inner_padding_top", "definition.data.styles.letter_spacing", "definition.data.styles.line_height", "definition.data.styles.mobile_stretch_content", "definition.data.styles.text_align", "definition.data.styles.text_decoration", "definition.data.styles.text_table_layout", "created", "updated", "screenshot_status", "screenshot_url"]
  if @api_client.config.client_side_validation && opts[:'fields_template_universal_content'] && !opts[:'fields_template_universal_content'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_template_universal_content\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/template-universal-content/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[template-universal-content]'] = @api_client.build_collection_param(opts[:'fields_template_universal_content'], :csv) if !opts[:'fields_template_universal_content'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"TemplatesApi.get_universal_content",
    :header_params => header_params,
    :query_params => query_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: TemplatesApi#get_universal_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end