<commit_before>class ContentItemPublisher
  def publish(flow_presenters)
    flow_presenters.each do |smart_answer|
      start_page_content_item = StartPageContentItem.new(smart_answer)
      Services.publishing_api.put_content(start_page_content_item.content_id, start_page_content_item.payload)
      Services.publishing_api.publish(start_page_content_item.content_id)

      flow_content_item = FlowContentItem.new(smart_answer)
      Services.publishing_api.put_content(flow_content_item.content_id, flow_content_item.payload)
      Services.publishing_api.publish(flow_content_item.content_id)
    end
  end

  def unpublish(content_id)
    raise "Content id has not been supplied" unless content_id.present?

    Services.publishing_api.unpublish(
      content_id,
      type: "gone",
      unpublished_at: Time.now
    )
  end<commit_msg>Add wrapper function for unpublishing with a type of redirect<commit_after>class ContentItemPublisher
  def publish(flow_presenters)
    flow_presenters.each do |smart_answer|
      start_page_content_item = StartPageContentItem.new(smart_answer)
      Services.publishing_api.put_content(start_page_content_item.content_id, start_page_content_item.payload)
      Services.publishing_api.publish(start_page_content_item.content_id)

      flow_content_item = FlowContentItem.new(smart_answer)
      Services.publishing_api.put_content(flow_content_item.content_id, flow_content_item.payload)
      Services.publishing_api.publish(flow_content_item.content_id)
    end
  end

  def unpublish(content_id)
    raise "Content id has not been supplied" unless content_id.present?

    Services.publishing_api.unpublish(
      content_id,
      type: "gone",
      unpublished_at: Time.now
    )
  end

  def unpublish_with_redirect(content_id, path, destination)
    raise "Content id has not been supplied" unless content_id.present?
    raise "Path has not been supplied" unless path.present?
    raise "Destination has not been supplied" unless destination.present?

    Services.publishing_api.unpublish(
      content_id,
      type: "redirect",
      redirects: [
        {
          path: path,
          type: :prefix,
          destination: destination,
          segments_mode: :ignore
        }
      ]
    )
  end
{'fraction_non_alphanumeric': 0.0674900749889722, 'fraction_numerical': 0.0, 'mean_word_length': 3.9411764705882355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5885012', 'n_tokens_mistral': 685, 'n_tokens_neox': 672, 'n_words': 125}