diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/CallToActionTileContentMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/CallToActionTileContentMarshaller.docx new file mode 100644 index 000000000..e2bb52189 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/CallToActionTileContentMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/CallToActionTileContentMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/CallToActionTileContentMarshaller.scala deleted file mode 100644 index 52e92691b..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/CallToActionTileContentMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tile - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.button.CtaButtonMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.richtext.RichTextMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tile.CallToActionTileContent -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class CallToActionTileContentMarshaller @Inject() ( - ctaButtonMarshaller: CtaButtonMarshaller, - richTextMarshaller: RichTextMarshaller) { - - def apply(callToActionTileContent: CallToActionTileContent): urt.TileContentCallToAction = - urt.TileContentCallToAction( - text = callToActionTileContent.text, - richText = callToActionTileContent.richText.map(richTextMarshaller(_)), - ctaButton = callToActionTileContent.ctaButton.map(ctaButtonMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/StandardTileContentMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/StandardTileContentMarshaller.docx new file mode 100644 index 000000000..5b8506733 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/StandardTileContentMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/StandardTileContentMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/StandardTileContentMarshaller.scala deleted file mode 100644 index 042f9dc69..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/StandardTileContentMarshaller.scala +++ /dev/null @@ -1,19 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tile - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.BadgeMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tile.StandardTileContent -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class StandardTileContentMarshaller @Inject() ( - badgeMarshaller: BadgeMarshaller) { - - def apply(standardTileContent: StandardTileContent): urt.TileContentStandard = - urt.TileContentStandard( - title = standardTileContent.title, - supportingText = standardTileContent.supportingText, - badge = standardTileContent.badge.map(badgeMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/TileContentMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/TileContentMarshaller.docx new file mode 100644 index 000000000..6b58fa3b0 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/TileContentMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/TileContentMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/TileContentMarshaller.scala deleted file mode 100644 index 2688a9e4d..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/TileContentMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tile - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tile.CallToActionTileContent -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tile.StandardTileContent -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tile.TileContent -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TileContentMarshaller @Inject() ( - standardTileContentMarshaller: StandardTileContentMarshaller, - callToActionTileContentMarshaller: CallToActionTileContentMarshaller) { - - def apply(tileContent: TileContent): urt.TileContent = tileContent match { - case tileCont: StandardTileContent => - urt.TileContent.Standard(standardTileContentMarshaller(tileCont)) - case tileCont: CallToActionTileContent => - urt.TileContent.CallToAction(callToActionTileContentMarshaller(tileCont)) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/TileItemMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/TileItemMarshaller.docx new file mode 100644 index 000000000..afa691aee Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/TileItemMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/TileItemMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/TileItemMarshaller.scala deleted file mode 100644 index e926568cc..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tile/TileItemMarshaller.scala +++ /dev/null @@ -1,28 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tile - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.ImageVariantMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.UrlMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tile.TileItem -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TileItemMarshaller @Inject() ( - tileContentMarshaller: TileContentMarshaller, - urlMarshaller: UrlMarshaller, - imageVariantMarshaller: ImageVariantMarshaller) { - - def apply(tileItem: TileItem): urt.TimelineItemContent = { - urt.TimelineItemContent.Tile( - urt.Tile( - title = tileItem.title, - supportingText = tileItem.supportingText, - url = tileItem.url.map(urlMarshaller(_)), - image = tileItem.image.map(imageVariantMarshaller(_)), - badge = None, - content = tileContentMarshaller(tileItem.content) - ) - ) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneDisplayTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneDisplayTypeMarshaller.docx new file mode 100644 index 000000000..7eff0d3f7 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneDisplayTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneDisplayTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneDisplayTypeMarshaller.scala deleted file mode 100644 index 323e2a429..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneDisplayTypeMarshaller.scala +++ /dev/null @@ -1,24 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tombstone - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tombstone.DisconnectedRepliesAncestor -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tombstone.DisconnectedRepliesDescendant -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tombstone.Inline -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tombstone.NonCompliant -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tombstone.TombstoneDisplayType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tombstone.TweetUnavailable -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TombstoneDisplayTypeMarshaller @Inject() () { - - def apply(tombstoneDisplayType: TombstoneDisplayType): urt.TombstoneDisplayType = - tombstoneDisplayType match { - case TweetUnavailable => urt.TombstoneDisplayType.TweetUnavailable - case DisconnectedRepliesAncestor => urt.TombstoneDisplayType.DisconnectedRepliesAncestor - case DisconnectedRepliesDescendant => urt.TombstoneDisplayType.DisconnectedRepliesDescendant - case Inline => urt.TombstoneDisplayType.Inline - case NonCompliant => urt.TombstoneDisplayType.NonCompliant - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneInfoMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneInfoMarshaller.docx new file mode 100644 index 000000000..3992f51d1 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneInfoMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneInfoMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneInfoMarshaller.scala deleted file mode 100644 index 0a996eee6..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneInfoMarshaller.scala +++ /dev/null @@ -1,18 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tombstone - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.richtext.RichTextMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tombstone.TombstoneInfo -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TombstoneInfoMarshaller @Inject() ( - richTextMarshaller: RichTextMarshaller) { - - def apply(tombstoneInfo: TombstoneInfo): urt.TombstoneInfo = urt.TombstoneInfo( - text = tombstoneInfo.text, - richText = tombstoneInfo.richText.map(richTextMarshaller(_)), - richRevealText = tombstoneInfo.richRevealText.map(richTextMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneItemMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneItemMarshaller.docx new file mode 100644 index 000000000..1a622c708 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneItemMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneItemMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneItemMarshaller.scala deleted file mode 100644 index 6cc94b38c..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tombstone/TombstoneItemMarshaller.scala +++ /dev/null @@ -1,23 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tombstone - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tweet.TweetItemMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tombstone.TombstoneItem -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TombstoneItemMarshaller @Inject() ( - displayTypeMarshaller: TombstoneDisplayTypeMarshaller, - tombstoneInfoMarshaller: TombstoneInfoMarshaller, - tweetItemMarshaller: TweetItemMarshaller) { - - def apply(tombstoneItem: TombstoneItem): urt.TimelineItemContent = - urt.TimelineItemContent.Tombstone( - urt.Tombstone( - displayType = displayTypeMarshaller(tombstoneItem.tombstoneDisplayType), - tombstoneInfo = tombstoneItem.tombstoneInfo.map(tombstoneInfoMarshaller(_)), - tweet = tombstoneItem.tweet.map(tweetItemMarshaller(_).tweet) - ) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicDisplayTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicDisplayTypeMarshaller.docx new file mode 100644 index 000000000..52abe413e Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicDisplayTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicDisplayTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicDisplayTypeMarshaller.scala deleted file mode 100644 index eb8d0187e..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicDisplayTypeMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.topic - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.BasicTopicDisplayType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.NoIconTopicDisplayType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.PillTopicDisplayType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.PillWithoutActionIconDisplayType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.TopicDisplayType -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TopicDisplayTypeMarshaller @Inject() () { - - def apply(topicDisplayType: TopicDisplayType): urt.TopicDisplayType = topicDisplayType match { - case BasicTopicDisplayType => urt.TopicDisplayType.Basic - case PillTopicDisplayType => urt.TopicDisplayType.Pill - case NoIconTopicDisplayType => urt.TopicDisplayType.NoIcon - case PillWithoutActionIconDisplayType => urt.TopicDisplayType.PillWithoutActionIcon - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFollowPromptDisplayTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFollowPromptDisplayTypeMarshaller.docx new file mode 100644 index 000000000..e8933bae3 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFollowPromptDisplayTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFollowPromptDisplayTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFollowPromptDisplayTypeMarshaller.scala deleted file mode 100644 index 97bed21f7..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFollowPromptDisplayTypeMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.topic - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.IncentiveFocusTopicFollowPromptDisplayType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.TopicFocusTopicFollowPromptDisplayType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.TopicFollowPromptDisplayType -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TopicFollowPromptDisplayTypeMarshaller @Inject() () { - - def apply( - topicFollowPromptDisplayType: TopicFollowPromptDisplayType - ): urt.TopicFollowPromptDisplayType = - topicFollowPromptDisplayType match { - case IncentiveFocusTopicFollowPromptDisplayType => - urt.TopicFollowPromptDisplayType.IncentiveFocus - case TopicFocusTopicFollowPromptDisplayType => urt.TopicFollowPromptDisplayType.TopicFocus - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFollowPromptItemMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFollowPromptItemMarshaller.docx new file mode 100644 index 000000000..687061d20 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFollowPromptItemMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFollowPromptItemMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFollowPromptItemMarshaller.scala deleted file mode 100644 index 05ebe46f7..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFollowPromptItemMarshaller.scala +++ /dev/null @@ -1,22 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.topic - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.TopicFollowPromptItem -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TopicFollowPromptItemMarshaller @Inject() ( - displayTypeMarshaller: TopicFollowPromptDisplayTypeMarshaller) { - - def apply(topicFollowPromptItem: TopicFollowPromptItem): urt.TimelineItemContent = { - urt.TimelineItemContent.TopicFollowPrompt( - urt.TopicFollowPrompt( - topicId = topicFollowPromptItem.id.toString, - displayType = displayTypeMarshaller(topicFollowPromptItem.topicFollowPromptDisplayType), - followIncentiveTitle = topicFollowPromptItem.followIncentiveTitle, - followIncentiveText = topicFollowPromptItem.followIncentiveText - ) - ) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFunctionalityTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFunctionalityTypeMarshaller.docx new file mode 100644 index 000000000..51afad213 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFunctionalityTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFunctionalityTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFunctionalityTypeMarshaller.scala deleted file mode 100644 index 4646c37a1..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicFunctionalityTypeMarshaller.scala +++ /dev/null @@ -1,20 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.topic - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.BasicTopicFunctionalityType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.PivotTopicFunctionalityType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.RecommendationTopicFunctionalityType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.TopicFunctionalityType -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TopicFunctionalityTypeMarshaller @Inject() () { - - def apply(topicFunctionalityType: TopicFunctionalityType): urt.TopicFunctionalityType = - topicFunctionalityType match { - case BasicTopicFunctionalityType => urt.TopicFunctionalityType.Basic - case RecommendationTopicFunctionalityType => urt.TopicFunctionalityType.Recommendation - case PivotTopicFunctionalityType => urt.TopicFunctionalityType.Pivot - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicItemMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicItemMarshaller.docx new file mode 100644 index 000000000..ca88c59b1 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicItemMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicItemMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicItemMarshaller.scala deleted file mode 100644 index ad43d16a7..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/topic/TopicItemMarshaller.scala +++ /dev/null @@ -1,26 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.topic - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic.TopicItem -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TopicItemMarshaller @Inject() ( - displayTypeMarshaller: TopicDisplayTypeMarshaller, - functionalityTypeMarshaller: TopicFunctionalityTypeMarshaller) { - - def apply(topicItem: TopicItem): urt.TimelineItemContent = { - urt.TimelineItemContent.Topic( - urt.Topic( - topicId = topicItem.id.toString, - topicDisplayType = topicItem.topicDisplayType - .map(displayTypeMarshaller(_)).getOrElse(urt.TopicDisplayType.Basic), - topicFunctionalityType = topicItem.topicFunctionalityType - .map(functionalityTypeMarshaller(_)).getOrElse(urt.TopicFunctionalityType.Basic), - // This is currently not required by users of this library - reactiveTriggers = None - ) - ) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/trend/TrendItemMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/trend/TrendItemMarshaller.docx new file mode 100644 index 000000000..f91ec0859 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/trend/TrendItemMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/trend/TrendItemMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/trend/TrendItemMarshaller.scala deleted file mode 100644 index 0386c5fa8..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/trend/TrendItemMarshaller.scala +++ /dev/null @@ -1,37 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.trend - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.UrlMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted.PromotedMetadataMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.trend.TrendItem -import com.twitter.timelines.render.thriftscala.GroupedTrend -import com.twitter.timelines.render.thriftscala.TrendMetadata -import javax.inject.Inject -import javax.inject.Singleton -import com.twitter.timelines.render.{thriftscala => urt} - -@Singleton -class TrendItemMarshaller @Inject() ( - promotedMetadataMarshaller: PromotedMetadataMarshaller, - urlMarshaller: UrlMarshaller) { - - def apply(trendItem: TrendItem): urt.TimelineItemContent = - urt.TimelineItemContent.Trend( - urt.Trend( - name = trendItem.trendName, - url = urlMarshaller(trendItem.url), - promotedMetadata = trendItem.promotedMetadata.map(promotedMetadataMarshaller(_)), - description = trendItem.description, - trendMetadata = Some( - TrendMetadata( - metaDescription = trendItem.metaDescription, - url = Some(urlMarshaller(trendItem.url)), - domainContext = trendItem.domainContext - )), - groupedTrends = trendItem.groupedTrends.map { trends => - trends.map { trend => - GroupedTrend(name = trend.trendName, url = urlMarshaller(trend.url)) - } - } - ) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TimelinesScoreInfoMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TimelinesScoreInfoMarshaller.docx new file mode 100644 index 000000000..db535e9a9 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TimelinesScoreInfoMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TimelinesScoreInfoMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TimelinesScoreInfoMarshaller.scala deleted file mode 100644 index 53f75b716..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TimelinesScoreInfoMarshaller.scala +++ /dev/null @@ -1,13 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tweet - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tweet.TimelinesScoreInfo -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TimelinesScoreInfoMarshaller @Inject() () { - - def apply(timelinesScoreInfo: TimelinesScoreInfo): urt.TimelinesScoreInfo = - urt.TimelinesScoreInfo(score = timelinesScoreInfo.score) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetDisplayTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetDisplayTypeMarshaller.docx new file mode 100644 index 000000000..15925f18e Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetDisplayTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetDisplayTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetDisplayTypeMarshaller.scala deleted file mode 100644 index 734dec577..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetDisplayTypeMarshaller.scala +++ /dev/null @@ -1,25 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tweet - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tweet._ -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TweetDisplayTypeMarshaller @Inject() () { - - def apply(tweetDisplayType: TweetDisplayType): urt.TweetDisplayType = tweetDisplayType match { - case Tweet => urt.TweetDisplayType.Tweet - case TweetFollowOnly => urt.TweetDisplayType.TweetFollowOnly - case Media => urt.TweetDisplayType.Media - case MomentTimelineTweet => urt.TweetDisplayType.MomentTimelineTweet - case EmphasizedPromotedTweet => urt.TweetDisplayType.EmphasizedPromotedTweet - case QuotedTweet => urt.TweetDisplayType.QuotedTweet - case SelfThread => urt.TweetDisplayType.SelfThread - case CompactPromotedTweet => urt.TweetDisplayType.CompactPromotedTweet - case TweetWithoutCard => urt.TweetDisplayType.TweetWithoutCard - case ReaderModeRoot => urt.TweetDisplayType.ReaderModeRoot - case ReaderMode => urt.TweetDisplayType.ReaderMode - case CondensedTweet => urt.TweetDisplayType.CondensedTweet - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetHighlightsMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetHighlightsMarshaller.docx new file mode 100644 index 000000000..a960bdf22 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetHighlightsMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetHighlightsMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetHighlightsMarshaller.scala deleted file mode 100644 index 10026f7ac..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetHighlightsMarshaller.scala +++ /dev/null @@ -1,22 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tweet - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.highlight.HighlightedSectionMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tweet.TweetHighlights -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TweetHighlightsMarshaller @Inject() ( - highlightedSectionMarshaller: HighlightedSectionMarshaller) { - - def apply(tweetHighlights: TweetHighlights): urt.TweetHighlights = - urt.TweetHighlights( - textHighlights = tweetHighlights.textHighlights - .map(_.map(highlightedSectionMarshaller(_))), - cardTitleHighlights = tweetHighlights.cardTitleHighlights - .map(_.map(highlightedSectionMarshaller(_))), - cardDescriptionHighlights = tweetHighlights.cardDescriptionHighlights - .map(_.map(highlightedSectionMarshaller(_))) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetItemMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetItemMarshaller.docx new file mode 100644 index 000000000..8034fd5c7 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetItemMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetItemMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetItemMarshaller.scala deleted file mode 100644 index ee5222e4f..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet/TweetItemMarshaller.scala +++ /dev/null @@ -1,52 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tweet - -import com.twitter.product_mixer.core.functional_component.marshaller.response.graphql.contextual_ref.ContextualTweetRefMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.conversation_annotation.ConversationAnnotationMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.forward_pivot.ForwardPivotMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tombstone.TombstoneInfoMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.SocialContextMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted.PrerollMetadataMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted.PromotedMetadataMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tweet.TweetItem -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.BadgeMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.UrlMarshaller -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TweetItemMarshaller @Inject() ( - tweetDisplayTypeMarshaller: TweetDisplayTypeMarshaller, - socialContextMarshaller: SocialContextMarshaller, - tweetHighlightsMarshaller: TweetHighlightsMarshaller, - tombstoneInfoMarshaller: TombstoneInfoMarshaller, - timelinesScoreInfoMarshaller: TimelinesScoreInfoMarshaller, - forwardPivotMarshaller: ForwardPivotMarshaller, - promotedMetadataMarshaller: PromotedMetadataMarshaller, - conversationAnnotationMarshaller: ConversationAnnotationMarshaller, - contextualTweetRefMarshaller: ContextualTweetRefMarshaller, - prerollMetadataMarshaller: PrerollMetadataMarshaller, - badgeMarshaller: BadgeMarshaller, - urlMarshaller: UrlMarshaller) { - - def apply(tweetItem: TweetItem): urt.TimelineItemContent.Tweet = urt.TimelineItemContent.Tweet( - urt.Tweet( - id = tweetItem.id, - displayType = tweetDisplayTypeMarshaller(tweetItem.displayType), - socialContext = tweetItem.socialContext.map(socialContextMarshaller(_)), - highlights = tweetItem.highlights.map(tweetHighlightsMarshaller(_)), - innerTombstoneInfo = tweetItem.innerTombstoneInfo.map(tombstoneInfoMarshaller(_)), - timelinesScoreInfo = tweetItem.timelinesScoreInfo.map(timelinesScoreInfoMarshaller(_)), - hasModeratedReplies = tweetItem.hasModeratedReplies, - forwardPivot = tweetItem.forwardPivot.map(forwardPivotMarshaller(_)), - innerForwardPivot = tweetItem.innerForwardPivot.map(forwardPivotMarshaller(_)), - promotedMetadata = tweetItem.promotedMetadata.map(promotedMetadataMarshaller(_)), - conversationAnnotation = - tweetItem.conversationAnnotation.map(conversationAnnotationMarshaller(_)), - contextualTweetRef = tweetItem.contextualTweetRef.map(contextualTweetRefMarshaller(_)), - prerollMetadata = tweetItem.prerollMetadata.map(prerollMetadataMarshaller(_)), - replyBadge = tweetItem.replyBadge.map(badgeMarshaller(_)), - destination = tweetItem.destination.map(urlMarshaller(_)) - ) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet_composer/TweetComposerDisplayTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet_composer/TweetComposerDisplayTypeMarshaller.docx new file mode 100644 index 000000000..982aed097 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet_composer/TweetComposerDisplayTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet_composer/TweetComposerDisplayTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet_composer/TweetComposerDisplayTypeMarshaller.scala deleted file mode 100644 index 1d0817ea4..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet_composer/TweetComposerDisplayTypeMarshaller.scala +++ /dev/null @@ -1,18 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tweet_composer - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tweet_composer.Reply -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tweet_composer.TweetComposerDisplayType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tweet_composer.TweetComposerSelfThread -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TweetComposerDisplayTypeMarshaller @Inject() () { - - def apply(displayType: TweetComposerDisplayType): urt.TweetComposerDisplayType = - displayType match { - case TweetComposerSelfThread => urt.TweetComposerDisplayType.SelfThread - case Reply => urt.TweetComposerDisplayType.Reply - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet_composer/TweetComposerItemMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet_composer/TweetComposerItemMarshaller.docx new file mode 100644 index 000000000..2bc9b23fa Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet_composer/TweetComposerItemMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet_composer/TweetComposerItemMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet_composer/TweetComposerItemMarshaller.scala deleted file mode 100644 index 8d018a9b6..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/tweet_composer/TweetComposerItemMarshaller.scala +++ /dev/null @@ -1,22 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.tweet_composer - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.UrlMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.tweet_composer.TweetComposerItem -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TweetComposerItemMarshaller @Inject() ( - tweetComposerDisplayTypeMarshaller: TweetComposerDisplayTypeMarshaller, - urlMarshaller: UrlMarshaller) { - - def apply(tweetComposer: TweetComposerItem): urt.TimelineItemContent = - urt.TimelineItemContent.TweetComposer( - urt.TweetComposer( - displayType = tweetComposerDisplayTypeMarshaller(tweetComposer.displayType), - text = tweetComposer.text, - url = urlMarshaller(tweetComposer.url) - ) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/twitter_list/TwitterListDisplayTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/twitter_list/TwitterListDisplayTypeMarshaller.docx new file mode 100644 index 000000000..f496ae020 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/twitter_list/TwitterListDisplayTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/twitter_list/TwitterListDisplayTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/twitter_list/TwitterListDisplayTypeMarshaller.scala deleted file mode 100644 index 3ee2e3611..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/twitter_list/TwitterListDisplayTypeMarshaller.scala +++ /dev/null @@ -1,22 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.twitter_list - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.twitter_list.List -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.twitter_list.ListTile -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.twitter_list.ListWithPin -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.twitter_list.ListWithSubscribe -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.twitter_list.TwitterListDisplayType -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TwitterListDisplayTypeMarshaller @Inject() () { - - def apply(twitterListDisplayType: TwitterListDisplayType): urt.TwitterListDisplayType = - twitterListDisplayType match { - case List => urt.TwitterListDisplayType.List - case ListTile => urt.TwitterListDisplayType.ListTile - case ListWithPin => urt.TwitterListDisplayType.ListWithPin - case ListWithSubscribe => urt.TwitterListDisplayType.ListWithSubscribe - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/twitter_list/TwitterListItemMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/twitter_list/TwitterListItemMarshaller.docx new file mode 100644 index 000000000..7378bf102 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/twitter_list/TwitterListItemMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/twitter_list/TwitterListItemMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/twitter_list/TwitterListItemMarshaller.scala deleted file mode 100644 index 9331ce0f7..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/twitter_list/TwitterListItemMarshaller.scala +++ /dev/null @@ -1,19 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.twitter_list - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.twitter_list.TwitterListItem -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TwitterListItemMarshaller @Inject() ( - twitterListDisplayTypeMarshaller: TwitterListDisplayTypeMarshaller) { - - def apply(twitterListItem: TwitterListItem): urt.TimelineItemContent = - urt.TimelineItemContent.TwitterList( - urt.TwitterList( - id = twitterListItem.id, - displayType = twitterListItem.displayType.map(twitterListDisplayTypeMarshaller(_)) - ) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserDisplayTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserDisplayTypeMarshaller.docx new file mode 100644 index 000000000..f6a9893c0 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserDisplayTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserDisplayTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserDisplayTypeMarshaller.scala deleted file mode 100644 index 2f2c18da2..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserDisplayTypeMarshaller.scala +++ /dev/null @@ -1,20 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.user - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.user.PendingFollowUser -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.user.User -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.user.UserDetailed -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.user.UserDisplayType -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class UserDisplayTypeMarshaller @Inject() () { - - def apply(userDisplayType: UserDisplayType): urt.UserDisplayType = - userDisplayType match { - case User => urt.UserDisplayType.User - case UserDetailed => urt.UserDisplayType.UserDetailed - case PendingFollowUser => urt.UserDisplayType.PendingFollowUser - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserItemMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserItemMarshaller.docx new file mode 100644 index 000000000..e782e950d Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserItemMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserItemMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserItemMarshaller.scala deleted file mode 100644 index d48b59d02..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserItemMarshaller.scala +++ /dev/null @@ -1,28 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.user - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.SocialContextMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted.PromotedMetadataMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.user.UserItem -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class UserItemMarshaller @Inject() ( - userDisplayTypeMarshaller: UserDisplayTypeMarshaller, - promotedMetadataMarshaller: PromotedMetadataMarshaller, - socialContextMarshaller: SocialContextMarshaller, - userReactiveTriggersMarshaller: UserReactiveTriggersMarshaller) { - - def apply(userItem: UserItem): urt.TimelineItemContent = - urt.TimelineItemContent.User( - urt.User( - id = userItem.id, - displayType = userDisplayTypeMarshaller(userItem.displayType), - promotedMetadata = userItem.promotedMetadata.map(promotedMetadataMarshaller(_)), - socialContext = userItem.socialContext.map(socialContextMarshaller(_)), - enableReactiveBlending = userItem.enableReactiveBlending, - reactiveTriggers = userItem.reactiveTriggers.map(userReactiveTriggersMarshaller(_)) - ) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserReactiveTriggersMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserReactiveTriggersMarshaller.docx new file mode 100644 index 000000000..7fdb7c476 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserReactiveTriggersMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserReactiveTriggersMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserReactiveTriggersMarshaller.scala deleted file mode 100644 index 35eb891d8..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/user/UserReactiveTriggersMarshaller.scala +++ /dev/null @@ -1,17 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.user - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.reaction.TimelineReactionMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.user.UserReactiveTriggers -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class UserReactiveTriggersMarshaller @Inject() ( - timelineReactionMarshaller: TimelineReactionMarshaller) { - - def apply(userReactiveTriggers: UserReactiveTriggers): urt.UserReactiveTriggers = { - urt.UserReactiveTriggers( - onFollow = userReactiveTriggers.onFollow.map(timelineReactionMarshaller(_))) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemContentMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemContentMarshaller.docx new file mode 100644 index 000000000..2dae7d9b3 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemContentMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemContentMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemContentMarshaller.scala deleted file mode 100644 index 396df8570..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemContentMarshaller.scala +++ /dev/null @@ -1,17 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.vertical_grid_item - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.vertical_grid_item.VerticalGridItem -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.vertical_grid_item.VerticalGridItemTopicTile -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class VerticalGridItemContentMarshaller @Inject() ( - verticalGridItemTopicTileMarshaller: VerticalGridItemTopicTileMarshaller) { - - def apply(item: VerticalGridItem): urt.VerticalGridItemContent = item match { - case verticalGridItemTopicTile: VerticalGridItemTopicTile => - verticalGridItemTopicTileMarshaller(verticalGridItemTopicTile) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemMarshaller.docx new file mode 100644 index 000000000..ec2bd06ac Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemMarshaller.scala deleted file mode 100644 index 4955fae5c..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemMarshaller.scala +++ /dev/null @@ -1,18 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.vertical_grid_item - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.vertical_grid_item.VerticalGridItem -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class VerticalGridItemMarshaller @Inject() ( - verticalGridItemContentMarshaller: VerticalGridItemContentMarshaller) { - - def apply(verticalGridItem: VerticalGridItem): urt.TimelineItemContent = - urt.TimelineItemContent.VerticalGridItem( - urt.VerticalGridItem( - content = verticalGridItemContentMarshaller(verticalGridItem) - ) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTileStyleMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTileStyleMarshaller.docx new file mode 100644 index 000000000..5d578c51b Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTileStyleMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTileStyleMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTileStyleMarshaller.scala deleted file mode 100644 index b0db79567..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTileStyleMarshaller.scala +++ /dev/null @@ -1,20 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.vertical_grid_item - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.vertical_grid_item.SingleStateDefaultVerticalGridItemTileStyle -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.vertical_grid_item.DoubleStateDefaultVerticalGridItemTileStyle -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.vertical_grid_item.VerticalGridItemTileStyle -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class VerticalGridItemTileStyleMarshaller @Inject() () { - - def apply(verticalGridItemTileStyle: VerticalGridItemTileStyle): urt.VerticalGridItemTileStyle = - verticalGridItemTileStyle match { - case SingleStateDefaultVerticalGridItemTileStyle => - urt.VerticalGridItemTileStyle.SingleStateDefault - case DoubleStateDefaultVerticalGridItemTileStyle => - urt.VerticalGridItemTileStyle.DoubleStateDefault - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTopicFunctionalityTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTopicFunctionalityTypeMarshaller.docx new file mode 100644 index 000000000..469f33e10 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTopicFunctionalityTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTopicFunctionalityTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTopicFunctionalityTypeMarshaller.scala deleted file mode 100644 index e31a11d14..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTopicFunctionalityTypeMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.vertical_grid_item - -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.vertical_grid_item.PivotVerticalGridItemTopicFunctionalityType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.vertical_grid_item.RecommendationVerticalGridItemTopicFunctionalityType -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.vertical_grid_item.VerticalGridItemTopicFunctionalityType -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class VerticalGridItemTopicFunctionalityTypeMarshaller @Inject() () { - - def apply( - verticalGridItemTopicFunctionalityType: VerticalGridItemTopicFunctionalityType - ): urt.VerticalGridItemTopicFunctionalityType = verticalGridItemTopicFunctionalityType match { - case PivotVerticalGridItemTopicFunctionalityType => - urt.VerticalGridItemTopicFunctionalityType.Pivot - case RecommendationVerticalGridItemTopicFunctionalityType => - urt.VerticalGridItemTopicFunctionalityType.Recommendation - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTopicTileMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTopicTileMarshaller.docx new file mode 100644 index 000000000..3f62f94de Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTopicTileMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTopicTileMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTopicTileMarshaller.scala deleted file mode 100644 index 4a67ad0ed..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/item/vertical_grid_item/VerticalGridItemTopicTileMarshaller.scala +++ /dev/null @@ -1,28 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.item.vertical_grid_item - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.UrlMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.item.vertical_grid_item.VerticalGridItemTopicTile -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class VerticalGridItemTopicTileMarshaller @Inject() ( - styleMarshaller: VerticalGridItemTileStyleMarshaller, - functionalityTypeMarshaller: VerticalGridItemTopicFunctionalityTypeMarshaller, - urlMarshaller: UrlMarshaller) { - - def apply(verticalGridItemTopicTile: VerticalGridItemTopicTile): urt.VerticalGridItemContent = - urt.VerticalGridItemContent.TopicTile( - urt.VerticalGridItemTopicTile( - topicId = verticalGridItemTopicTile.id.toString, - style = verticalGridItemTopicTile.style - .map(styleMarshaller(_)).getOrElse(urt.VerticalGridItemTileStyle.SingleStateDefault), - functionalityType = verticalGridItemTopicTile.functionalityType - .map(functionalityTypeMarshaller(_)).getOrElse( - urt.VerticalGridItemTopicFunctionalityType.Pivot), - url = verticalGridItemTopicTile.url.map(urlMarshaller(_)) - ) - ) - -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/AspectRatioMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/AspectRatioMarshaller.docx new file mode 100644 index 000000000..682ee3d9d Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/AspectRatioMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/AspectRatioMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/AspectRatioMarshaller.scala deleted file mode 100644 index 816327cc6..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/AspectRatioMarshaller.scala +++ /dev/null @@ -1,15 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.media - -import com.twitter.product_mixer.core.model.marshalling.response.urt.media.AspectRatio -import javax.inject.Inject -import javax.inject.Singleton -import com.twitter.timelines.render.{thriftscala => urt} - -@Singleton -class AspectRatioMarshaller @Inject() () { - - def apply(aspectRatio: AspectRatio): urt.AspectRatio = urt.AspectRatio( - numerator = aspectRatio.numerator, - denominator = aspectRatio.denominator - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/BUILD deleted file mode 100644 index 76deb3159..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/BUILD +++ /dev/null @@ -1,17 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/media", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], - exports = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/media", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/BUILD.docx new file mode 100644 index 000000000..5e2cf853d Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/BroadcastIdMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/BroadcastIdMarshaller.docx new file mode 100644 index 000000000..15e8114f2 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/BroadcastIdMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/BroadcastIdMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/BroadcastIdMarshaller.scala deleted file mode 100644 index c1abb20f7..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/BroadcastIdMarshaller.scala +++ /dev/null @@ -1,14 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.media - -import com.twitter.product_mixer.core.model.marshalling.response.urt.media.BroadcastId -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class BroadcastIdMarshaller @Inject() () { - - def apply(broadcastId: BroadcastId): urt.BroadcastId = urt.BroadcastId( - id = broadcastId.id - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaEntityMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaEntityMarshaller.docx new file mode 100644 index 000000000..83d8c34a9 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaEntityMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaEntityMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaEntityMarshaller.scala deleted file mode 100644 index b662e0a8b..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaEntityMarshaller.scala +++ /dev/null @@ -1,23 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.media - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.ImageVariantMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.media.BroadcastId -import com.twitter.product_mixer.core.model.marshalling.response.urt.media.Image -import com.twitter.product_mixer.core.model.marshalling.response.urt.media.MediaEntity -import com.twitter.product_mixer.core.model.marshalling.response.urt.media.TweetMedia -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class MediaEntityMarshaller @Inject() ( - tweetMediaMarshaller: TweetMediaMarshaller, - broadcastIdMarshaller: BroadcastIdMarshaller, - imageVariantMarshaller: ImageVariantMarshaller) { - - def apply(mediaEntity: MediaEntity): urt.MediaEntity = mediaEntity match { - case tweetMedia: TweetMedia => urt.MediaEntity.TweetMedia(tweetMediaMarshaller(tweetMedia)) - case broadcastId: BroadcastId => urt.MediaEntity.BroadcastId(broadcastIdMarshaller(broadcastId)) - case image: Image => urt.MediaEntity.Image(imageVariantMarshaller(image.image)) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaKeyMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaKeyMarshaller.docx new file mode 100644 index 000000000..ed36383a3 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaKeyMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaKeyMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaKeyMarshaller.scala deleted file mode 100644 index 0ab4e36d5..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaKeyMarshaller.scala +++ /dev/null @@ -1,15 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.media - -import com.twitter.product_mixer.core.model.marshalling.response.urt.media.MediaKey -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class MediaKeyMarshaller @Inject() () { - - def apply(mediaKey: MediaKey): urt.MediaKey = urt.MediaKey( - id = mediaKey.id, - category = mediaKey.category - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaMarshaller.docx new file mode 100644 index 000000000..a7c70d1f1 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaMarshaller.scala deleted file mode 100644 index 1a1f18f04..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/MediaMarshaller.scala +++ /dev/null @@ -1,23 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.media - -import com.twitter.product_mixer.core.model.marshalling.response.urt.media.Media -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class MediaMarshaller @Inject() ( - mediaEntityMarshaller: MediaEntityMarshaller, - mediaKeyMarshaller: MediaKeyMarshaller, - rectMarshaller: RectMarshaller, - aspectRatioMarshaller: AspectRatioMarshaller) { - - def apply(media: Media): urt.Media = urt.Media( - mediaEntity = media.mediaEntity.map(mediaEntityMarshaller(_)), - mediaKey = media.mediaKey.map(mediaKeyMarshaller(_)), - imagePossibleCropping = media.imagePossibleCropping.map { rects => - rects.map(rectMarshaller(_)) - }, - aspectRatio = media.aspectRatio.map(aspectRatioMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/RectMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/RectMarshaller.docx new file mode 100644 index 000000000..9cc44fe54 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/RectMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/RectMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/RectMarshaller.scala deleted file mode 100644 index 155243393..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/RectMarshaller.scala +++ /dev/null @@ -1,17 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.media - -import com.twitter.product_mixer.core.model.marshalling.response.urt.media.Rect -import javax.inject.Inject -import javax.inject.Singleton -import com.twitter.timelines.render.{thriftscala => urt} - -@Singleton -class RectMarshaller @Inject() () { - - def apply(rect: Rect): urt.Rect = urt.Rect( - left = rect.left, - top = rect.top, - width = rect.width, - height = rect.height - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/TweetMediaMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/TweetMediaMarshaller.docx new file mode 100644 index 000000000..631ffbe4e Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/TweetMediaMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/TweetMediaMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/TweetMediaMarshaller.scala deleted file mode 100644 index 0c4183c73..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/media/TweetMediaMarshaller.scala +++ /dev/null @@ -1,15 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.media - -import com.twitter.product_mixer.core.model.marshalling.response.urt.media.TweetMedia -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TweetMediaMarshaller @Inject() () { - - def apply(tweetMedia: TweetMedia): urt.TweetMedia = urt.TweetMedia( - tweetId = tweetMedia.tweetId, - momentId = tweetMedia.momentId - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ArticleDetailsMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ArticleDetailsMarshaller.docx new file mode 100644 index 000000000..b4cd6fb10 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ArticleDetailsMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ArticleDetailsMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ArticleDetailsMarshaller.scala deleted file mode 100644 index d5e356ad9..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ArticleDetailsMarshaller.scala +++ /dev/null @@ -1,15 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ArticleDetails -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ArticleDetailsMarshaller @Inject() () { - - def apply(articleDetails: ArticleDetails): urt.ArticleDetails = urt.ArticleDetails( - articlePosition = articleDetails.articlePosition, - shareCount = articleDetails.shareCount - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/BUILD deleted file mode 100644 index e516fc9b4..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/BUILD +++ /dev/null @@ -1,21 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/color", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/icon", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], - exports = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/color", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/icon", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/BUILD.docx new file mode 100644 index 000000000..db5d28425 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/BadgeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/BadgeMarshaller.docx new file mode 100644 index 000000000..d23796c4c Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/BadgeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/BadgeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/BadgeMarshaller.scala deleted file mode 100644 index 569cd6a81..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/BadgeMarshaller.scala +++ /dev/null @@ -1,18 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.color.RosettaColorMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.Badge -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class BadgeMarshaller @Inject() ( - rosettaColorMarshaller: RosettaColorMarshaller) { - - def apply(badge: Badge): urt.Badge = urt.Badge( - text = badge.text, - textColorName = badge.textColorName.map(rosettaColorMarshaller(_)), - backgroundColorName = badge.backgroundColorName.map(rosettaColorMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/CallbackMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/CallbackMarshaller.docx new file mode 100644 index 000000000..edccbc1e0 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/CallbackMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/CallbackMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/CallbackMarshaller.scala deleted file mode 100644 index f1cbddfe5..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/CallbackMarshaller.scala +++ /dev/null @@ -1,14 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.Callback -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class CallbackMarshaller @Inject() () { - - def apply(callback: Callback): urt.Callback = urt.Callback( - endpoint = callback.endpoint - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ChildFeedbackActionMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ChildFeedbackActionMarshaller.docx new file mode 100644 index 000000000..e99c633c7 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ChildFeedbackActionMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ChildFeedbackActionMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ChildFeedbackActionMarshaller.scala deleted file mode 100644 index 6a3df4dbc..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ChildFeedbackActionMarshaller.scala +++ /dev/null @@ -1,33 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.icon.HorizonIconMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ChildFeedbackAction -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ChildFeedbackActionMarshaller @Inject() ( - feedbackTypeMarshaller: FeedbackTypeMarshaller, - confirmationDisplayTypeMarshaller: ConfirmationDisplayTypeMarshaller, - clientEventInfoMarshaller: ClientEventInfoMarshaller, - horizonIconMarshaller: HorizonIconMarshaller, - richFeedbackBehaviorMarshaller: RichFeedbackBehaviorMarshaller) { - - def apply(feedbackAction: ChildFeedbackAction): urt.FeedbackAction = { - urt.FeedbackAction( - feedbackType = feedbackTypeMarshaller(feedbackAction.feedbackType), - prompt = feedbackAction.prompt, - confirmation = feedbackAction.confirmation, - childKeys = None, - feedbackUrl = feedbackAction.feedbackUrl, - hasUndoAction = feedbackAction.hasUndoAction, - confirmationDisplayType = - feedbackAction.confirmationDisplayType.map(confirmationDisplayTypeMarshaller(_)), - clientEventInfo = feedbackAction.clientEventInfo.map(clientEventInfoMarshaller(_)), - icon = feedbackAction.icon.map(horizonIconMarshaller(_)), - richBehavior = feedbackAction.richBehavior.map(richFeedbackBehaviorMarshaller(_)), - subprompt = feedbackAction.subprompt - ) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ClientEventDetailsMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ClientEventDetailsMarshaller.docx new file mode 100644 index 000000000..dc149dacb Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ClientEventDetailsMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ClientEventDetailsMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ClientEventDetailsMarshaller.scala deleted file mode 100644 index 6d24a048a..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ClientEventDetailsMarshaller.scala +++ /dev/null @@ -1,26 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ClientEventDetails -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ClientEventDetailsMarshaller @Inject() ( - conversationDetailsMarshaller: ConversationDetailsMarshaller, - timelinesDetailsMarshaller: TimelinesDetailsMarshaller, - articleDetailsMarshaller: ArticleDetailsMarshaller, - liveEventDetailsMarshaller: LiveEventDetailsMarshaller, - commerceDetailsMarshaller: CommerceDetailsMarshaller) { - - def apply(clientEventDetails: ClientEventDetails): urt.ClientEventDetails = { - urt.ClientEventDetails( - conversationDetails = - clientEventDetails.conversationDetails.map(conversationDetailsMarshaller(_)), - timelinesDetails = clientEventDetails.timelinesDetails.map(timelinesDetailsMarshaller(_)), - articleDetails = clientEventDetails.articleDetails.map(articleDetailsMarshaller(_)), - liveEventDetails = clientEventDetails.liveEventDetails.map(liveEventDetailsMarshaller(_)), - commerceDetails = clientEventDetails.commerceDetails.map(commerceDetailsMarshaller(_)) - ) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ClientEventInfoMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ClientEventInfoMarshaller.docx new file mode 100644 index 000000000..5fb2ac73d Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ClientEventInfoMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ClientEventInfoMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ClientEventInfoMarshaller.scala deleted file mode 100644 index aff10b9ed..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ClientEventInfoMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ClientEventInfo -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ClientEventInfoMarshaller @Inject() ( - clientEventDetailsMarshaller: ClientEventDetailsMarshaller) { - - def apply(clientEventInfo: ClientEventInfo): urt.ClientEventInfo = { - urt.ClientEventInfo( - component = clientEventInfo.component, - element = clientEventInfo.element, - details = clientEventInfo.details.map(clientEventDetailsMarshaller(_)), - action = clientEventInfo.action, - entityToken = clientEventInfo.entityToken - ) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/CommerceDetailsMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/CommerceDetailsMarshaller.docx new file mode 100644 index 000000000..a26f913bd Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/CommerceDetailsMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/CommerceDetailsMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/CommerceDetailsMarshaller.scala deleted file mode 100644 index 3b14c7a05..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/CommerceDetailsMarshaller.scala +++ /dev/null @@ -1,18 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.CommerceDetails -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class CommerceDetailsMarshaller @Inject() () { - - def apply(commerceDetails: CommerceDetails): urt.CommerceDetails = urt.CommerceDetails( - dropId = commerceDetails.dropId, - shopV2Id = commerceDetails.shopV2Id, - productKey = commerceDetails.productKey, - merchantId = commerceDetails.merchantId, - productIndex = commerceDetails.productIndex, - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConfirmationDisplayTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConfirmationDisplayTypeMarshaller.docx new file mode 100644 index 000000000..ff5b1a1d8 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConfirmationDisplayTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConfirmationDisplayTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConfirmationDisplayTypeMarshaller.scala deleted file mode 100644 index 78a74254f..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConfirmationDisplayTypeMarshaller.scala +++ /dev/null @@ -1,18 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.BottomSheet -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ConfirmationDisplayType -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.Inline -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ConfirmationDisplayTypeMarshaller @Inject() () { - - def apply(confirmationDisplayType: ConfirmationDisplayType): urt.ConfirmationDisplayType = - confirmationDisplayType match { - case Inline => urt.ConfirmationDisplayType.Inline - case BottomSheet => urt.ConfirmationDisplayType.BottomSheet - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConversationDetailsMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConversationDetailsMarshaller.docx new file mode 100644 index 000000000..32e5ab73c Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConversationDetailsMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConversationDetailsMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConversationDetailsMarshaller.scala deleted file mode 100644 index 88889bb5f..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConversationDetailsMarshaller.scala +++ /dev/null @@ -1,15 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ConversationDetails -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ConversationDetailsMarshaller @Inject() (sectionMarshaller: ConversationSectionMarshaller) { - - def apply(conversationDetails: ConversationDetails): urt.ConversationDetails = - urt.ConversationDetails( - conversationSection = conversationDetails.conversationSection.map(sectionMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConversationSectionMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConversationSectionMarshaller.docx new file mode 100644 index 000000000..d55a3b3b6 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConversationSectionMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConversationSectionMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConversationSectionMarshaller.scala deleted file mode 100644 index 0ae3e5bf0..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ConversationSectionMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.AbusiveQuality -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ConversationSection -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.HighQuality -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.LowQuality -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RelatedTweet -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ConversationSectionMarshaller @Inject() () { - - def apply(section: ConversationSection): urt.ConversationSection = section match { - case HighQuality => urt.ConversationSection.HighQuality - case LowQuality => urt.ConversationSection.LowQuality - case AbusiveQuality => urt.ConversationSection.AbusiveQuality - case RelatedTweet => urt.ConversationSection.RelatedTweet - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/DismissInfoMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/DismissInfoMarshaller.docx new file mode 100644 index 000000000..74c07bca6 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/DismissInfoMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/DismissInfoMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/DismissInfoMarshaller.scala deleted file mode 100644 index 61bcdec68..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/DismissInfoMarshaller.scala +++ /dev/null @@ -1,13 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.DismissInfo -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class DismissInfoMarshaller @Inject() (callbackMarshaller: CallbackMarshaller) { - - def apply(dismissInfo: DismissInfo): urt.DismissInfo = - urt.DismissInfo(dismissInfo.callbacks.map(_.map(callbackMarshaller(_)))) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackActionMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackActionMarshaller.docx new file mode 100644 index 000000000..0fa8e59fe Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackActionMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackActionMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackActionMarshaller.scala deleted file mode 100644 index 5be361b30..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackActionMarshaller.scala +++ /dev/null @@ -1,48 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.icon.HorizonIconMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.FeedbackActionMarshaller.generateKey -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.FeedbackAction -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -object FeedbackActionMarshaller { - def generateKey(feedbackAction: urt.FeedbackAction): String = { - feedbackAction.hashCode.toString - } -} - -@Singleton -class FeedbackActionMarshaller @Inject() ( - childFeedbackActionMarshaller: ChildFeedbackActionMarshaller, - feedbackTypeMarshaller: FeedbackTypeMarshaller, - confirmationDisplayTypeMarshaller: ConfirmationDisplayTypeMarshaller, - clientEventInfoMarshaller: ClientEventInfoMarshaller, - horizonIconMarshaller: HorizonIconMarshaller, - richFeedbackBehaviorMarshaller: RichFeedbackBehaviorMarshaller) { - - def apply(feedbackAction: FeedbackAction): urt.FeedbackAction = { - val childKeys = feedbackAction.childFeedbackActions - .map(_.map { childFeedbackAction => - val urtChildFeedbackAction = childFeedbackActionMarshaller(childFeedbackAction) - generateKey(urtChildFeedbackAction) - }) - - urt.FeedbackAction( - feedbackType = feedbackTypeMarshaller(feedbackAction.feedbackType), - prompt = feedbackAction.prompt, - confirmation = feedbackAction.confirmation, - childKeys = childKeys, - feedbackUrl = feedbackAction.feedbackUrl, - hasUndoAction = feedbackAction.hasUndoAction, - confirmationDisplayType = - feedbackAction.confirmationDisplayType.map(confirmationDisplayTypeMarshaller(_)), - clientEventInfo = feedbackAction.clientEventInfo.map(clientEventInfoMarshaller(_)), - icon = feedbackAction.icon.map(horizonIconMarshaller(_)), - richBehavior = feedbackAction.richBehavior.map(richFeedbackBehaviorMarshaller(_)), - subprompt = feedbackAction.subprompt, - encodedFeedbackRequest = feedbackAction.encodedFeedbackRequest - ) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackDisplayContextMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackDisplayContextMarshaller.docx new file mode 100644 index 000000000..7ed7832e6 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackDisplayContextMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackDisplayContextMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackDisplayContextMarshaller.scala deleted file mode 100644 index 068450e02..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackDisplayContextMarshaller.scala +++ /dev/null @@ -1,15 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.FeedbackDisplayContext -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class FeedbackDisplayContextMarshaller @Inject() () { - - def apply(displayContext: FeedbackDisplayContext): urt.FeedbackDisplayContext = - urt.FeedbackDisplayContext( - reason = displayContext.reason - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackInfoMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackInfoMarshaller.docx new file mode 100644 index 000000000..6cce9dd75 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackInfoMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackInfoMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackInfoMarshaller.scala deleted file mode 100644 index 5f8b4b988..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackInfoMarshaller.scala +++ /dev/null @@ -1,22 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.FeedbackActionInfo -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class FeedbackInfoMarshaller @Inject() ( - feedbackActionMarshaller: FeedbackActionMarshaller, - feedbackDisplayContextMarshaller: FeedbackDisplayContextMarshaller, - clientEventInfoMarshaller: ClientEventInfoMarshaller) { - - def apply(feedbackActionInfo: FeedbackActionInfo): urt.FeedbackInfo = urt.FeedbackInfo( - // Generate key from the hashcode of the marshalled feedback action URT - feedbackKeys = feedbackActionInfo.feedbackActions - .map(feedbackActionMarshaller(_)).map(FeedbackActionMarshaller.generateKey), - feedbackMetadata = feedbackActionInfo.feedbackMetadata, - displayContext = feedbackActionInfo.displayContext.map(feedbackDisplayContextMarshaller(_)), - clientEventInfo = feedbackActionInfo.clientEventInfo.map(clientEventInfoMarshaller(_)), - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackTypeMarshaller.docx new file mode 100644 index 000000000..8d9995c84 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackTypeMarshaller.scala deleted file mode 100644 index 6b76c31e0..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/FeedbackTypeMarshaller.scala +++ /dev/null @@ -1,27 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata._ -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class FeedbackTypeMarshaller @Inject() () { - - def apply(feedbackType: FeedbackType): urt.FeedbackType = feedbackType match { - case Dismiss => urt.FeedbackType.Dismiss - case SeeFewer => urt.FeedbackType.SeeFewer - case DontLike => urt.FeedbackType.DontLike - case NotRelevant => urt.FeedbackType.NotRelevant - case SeeMore => urt.FeedbackType.SeeMore - case NotCredible => urt.FeedbackType.NotCredible - case GiveFeedback => urt.FeedbackType.GiveFeedback - case NotRecent => urt.FeedbackType.NotRecent - case UnfollowEntity => urt.FeedbackType.UnfollowEntity - case Relevant => urt.FeedbackType.Relevant - case Moderate => urt.FeedbackType.Moderate - case RichBehavior => urt.FeedbackType.RichBehavior - case NotAboutTopic => urt.FeedbackType.NotAboutTopic - case Generic => urt.FeedbackType.Generic - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/GeneralContextMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/GeneralContextMarshaller.docx new file mode 100644 index 000000000..ec0e51aa0 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/GeneralContextMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/GeneralContextMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/GeneralContextMarshaller.scala deleted file mode 100644 index 91c2033cc..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/GeneralContextMarshaller.scala +++ /dev/null @@ -1,24 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.GeneralContext -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class GeneralContextMarshaller @Inject() ( - generalContextTypeMarshaller: GeneralContextTypeMarshaller, - urlMarshaller: UrlMarshaller) { - - def apply(generalContext: GeneralContext): urt.SocialContext = { - urt.SocialContext.GeneralContext( - urt.GeneralContext( - contextType = generalContextTypeMarshaller(generalContext.contextType), - text = generalContext.text, - url = generalContext.url, - contextImageUrls = generalContext.contextImageUrls, - landingUrl = generalContext.landingUrl.map(urlMarshaller(_)) - ) - ) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/GeneralContextTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/GeneralContextTypeMarshaller.docx new file mode 100644 index 000000000..7fa35b87e Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/GeneralContextTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/GeneralContextTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/GeneralContextTypeMarshaller.scala deleted file mode 100644 index 982be27ab..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/GeneralContextTypeMarshaller.scala +++ /dev/null @@ -1,35 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata._ -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class GeneralContextTypeMarshaller @Inject() () { - - def apply(generalContextType: GeneralContextType): urt.ContextType = generalContextType match { - case LikeGeneralContextType => urt.ContextType.Like - case FollowGeneralContextType => urt.ContextType.Follow - case MomentGeneralContextType => urt.ContextType.Moment - case ReplyGeneralContextType => urt.ContextType.Reply - case ConversationGeneralContextType => urt.ContextType.Conversation - case PinGeneralContextType => urt.ContextType.Pin - case TextOnlyGeneralContextType => urt.ContextType.TextOnly - case FacePileGeneralContextType => urt.ContextType.Facepile - case MegaPhoneGeneralContextType => urt.ContextType.Megaphone - case BirdGeneralContextType => urt.ContextType.Bird - case FeedbackGeneralContextType => urt.ContextType.Feedback - case TopicGeneralContextType => urt.ContextType.Topic - case ListGeneralContextType => urt.ContextType.List - case RetweetGeneralContextType => urt.ContextType.Retweet - case LocationGeneralContextType => urt.ContextType.Location - case CommunityGeneralContextType => urt.ContextType.Community - case NewUserGeneralContextType => urt.ContextType.NewUser - case SmartblockExpirationGeneralContextType => urt.ContextType.SmartBlockExpiration - case TrendingGeneralContextType => urt.ContextType.Trending - case SparkleGeneralContextType => urt.ContextType.Sparkle - case SpacesGeneralContextType => urt.ContextType.Spaces - case ReplyPinGeneralContextType => urt.ContextType.ReplyPin - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageAnimationTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageAnimationTypeMarshaller.docx new file mode 100644 index 000000000..5a9871648 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageAnimationTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageAnimationTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageAnimationTypeMarshaller.scala deleted file mode 100644 index 50c0c2519..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageAnimationTypeMarshaller.scala +++ /dev/null @@ -1,16 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ImageAnimationType -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.Bounce -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ImageAnimationTypeMarshaller @Inject() () { - - def apply(imageAnimationType: ImageAnimationType): urt.ImageAnimationType = - imageAnimationType match { - case Bounce => urt.ImageAnimationType.Bounce - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageDisplayTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageDisplayTypeMarshaller.docx new file mode 100644 index 000000000..73adc7045 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageDisplayTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageDisplayTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageDisplayTypeMarshaller.scala deleted file mode 100644 index 6021f26e8..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageDisplayTypeMarshaller.scala +++ /dev/null @@ -1,20 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ImageDisplayType -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.Icon -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.FullWidth -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.IconSmall -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ImageDisplayTypeMarshaller @Inject() () { - - def apply(imageDisplayType: ImageDisplayType): urt.ImageDisplayType = - imageDisplayType match { - case Icon => urt.ImageDisplayType.Icon - case FullWidth => urt.ImageDisplayType.FullWidth - case IconSmall => urt.ImageDisplayType.IconSmall - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageVariantMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageVariantMarshaller.docx new file mode 100644 index 000000000..30c6e52d8 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageVariantMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageVariantMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageVariantMarshaller.scala deleted file mode 100644 index a5711cf43..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/ImageVariantMarshaller.scala +++ /dev/null @@ -1,19 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.color.ColorPaletteMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ImageVariant -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ImageVariantMarshaller @Inject() ( - colorPaletteMarshaller: ColorPaletteMarshaller) { - - def apply(imageVariant: ImageVariant): urt.ImageVariant = urt.ImageVariant( - url = imageVariant.url, - width = imageVariant.width, - height = imageVariant.height, - palette = imageVariant.palette.map { paletteList => paletteList.map(colorPaletteMarshaller(_)) } - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/LiveEventDetailsMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/LiveEventDetailsMarshaller.docx new file mode 100644 index 000000000..8507cdf74 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/LiveEventDetailsMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/LiveEventDetailsMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/LiveEventDetailsMarshaller.scala deleted file mode 100644 index e07d20251..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/LiveEventDetailsMarshaller.scala +++ /dev/null @@ -1,14 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.LiveEventDetails -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class LiveEventDetailsMarshaller @Inject() () { - - def apply(liveEventDetails: LiveEventDetails): urt.LiveEventDetails = urt.LiveEventDetails( - eventId = liveEventDetails.eventId - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/RichFeedbackBehaviorMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/RichFeedbackBehaviorMarshaller.docx new file mode 100644 index 000000000..642a211ac Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/RichFeedbackBehaviorMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/RichFeedbackBehaviorMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/RichFeedbackBehaviorMarshaller.scala deleted file mode 100644 index 43ec36fe4..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/RichFeedbackBehaviorMarshaller.scala +++ /dev/null @@ -1,55 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.NotPinnableReplyPinState -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.PinnableReplyPinState -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.PinnedReplyPinState -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RichFeedbackBehavior -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RichFeedbackBehaviorBlockUser -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RichFeedbackBehaviorMarkNotInterestedTopic -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RichFeedbackBehaviorReplyPinState -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RichFeedbackBehaviorReportList -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RichFeedbackBehaviorReportTweet -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RichFeedbackBehaviorToggleFollowTopic -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RichFeedbackBehaviorToggleFollowTopicV2 -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RichFeedbackBehaviorToggleFollowUser -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RichFeedbackBehaviorToggleMuteList -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RichFeedbackBehaviorToggleMuteUser -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class RichFeedbackBehaviorMarshaller @Inject() () { - - def apply(richFeedbackBehavior: RichFeedbackBehavior): urt.RichFeedbackBehavior = - richFeedbackBehavior match { - case RichFeedbackBehaviorReportList(listId, userId) => - urt.RichFeedbackBehavior.ReportList(urt.RichFeedbackBehaviorReportList(listId, userId)) - case RichFeedbackBehaviorBlockUser(userId) => - urt.RichFeedbackBehavior.BlockUser(urt.RichFeedbackBehaviorBlockUser(userId)) - case RichFeedbackBehaviorToggleFollowTopic(topicId) => - urt.RichFeedbackBehavior.ToggleFollowTopic( - urt.RichFeedbackBehaviorToggleFollowTopic(topicId)) - case RichFeedbackBehaviorToggleFollowTopicV2(topicId) => - urt.RichFeedbackBehavior.ToggleFollowTopicV2( - urt.RichFeedbackBehaviorToggleFollowTopicV2(topicId)) - case RichFeedbackBehaviorToggleMuteList(listId) => - urt.RichFeedbackBehavior.ToggleMuteList(urt.RichFeedbackBehaviorToggleMuteList(listId)) - case RichFeedbackBehaviorMarkNotInterestedTopic(topicId) => - urt.RichFeedbackBehavior.MarkNotInterestedTopic( - urt.RichFeedbackBehaviorMarkNotInterestedTopic(topicId)) - case RichFeedbackBehaviorReplyPinState(replyPinState) => - val pinState: urt.ReplyPinState = replyPinState match { - case PinnedReplyPinState => urt.ReplyPinState.Pinned - case PinnableReplyPinState => urt.ReplyPinState.Pinnable - case NotPinnableReplyPinState => urt.ReplyPinState.NotPinnable - } - urt.RichFeedbackBehavior.ReplyPinState(urt.RichFeedbackBehaviorReplyPinState(pinState)) - case RichFeedbackBehaviorToggleMuteUser(userId) => - urt.RichFeedbackBehavior.ToggleMuteUser(urt.RichFeedbackBehaviorToggleMuteUser(userId)) - case RichFeedbackBehaviorToggleFollowUser(userId) => - urt.RichFeedbackBehavior.ToggleFollowUser(urt.RichFeedbackBehaviorToggleFollowUser(userId)) - case RichFeedbackBehaviorReportTweet(entryId) => - urt.RichFeedbackBehavior.ReportTweet(urt.RichFeedbackBehaviorReportTweet(entryId)) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/SocialContextMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/SocialContextMarshaller.docx new file mode 100644 index 000000000..a426dc5b0 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/SocialContextMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/SocialContextMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/SocialContextMarshaller.scala deleted file mode 100644 index 7d43812ea..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/SocialContextMarshaller.scala +++ /dev/null @@ -1,22 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.timelines.render.{thriftscala => urt} -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.GeneralContext -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.SocialContext -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.TopicContext -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class SocialContextMarshaller @Inject() ( - generalContextMarshaller: GeneralContextMarshaller, - topicContextMarshaller: TopicContextMarshaller) { - - def apply(socialContext: SocialContext): urt.SocialContext = - socialContext match { - case generalContextBanner: GeneralContext => - generalContextMarshaller(generalContextBanner) - case topicContextBanner: TopicContext => - topicContextMarshaller(topicContextBanner) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TimelinesDetailsMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TimelinesDetailsMarshaller.docx new file mode 100644 index 000000000..1d9e45bb0 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TimelinesDetailsMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TimelinesDetailsMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TimelinesDetailsMarshaller.scala deleted file mode 100644 index 657f49e75..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TimelinesDetailsMarshaller.scala +++ /dev/null @@ -1,16 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.TimelinesDetails -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TimelinesDetailsMarshaller @Inject() () { - - def apply(timelinesDetails: TimelinesDetails): urt.TimelinesDetails = urt.TimelinesDetails( - injectionType = timelinesDetails.injectionType, - controllerData = timelinesDetails.controllerData, - sourceData = timelinesDetails.sourceData - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TopicContextFunctionalityTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TopicContextFunctionalityTypeMarshaller.docx new file mode 100644 index 000000000..7c69ca4ac Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TopicContextFunctionalityTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TopicContextFunctionalityTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TopicContextFunctionalityTypeMarshaller.scala deleted file mode 100644 index e46f64614..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TopicContextFunctionalityTypeMarshaller.scala +++ /dev/null @@ -1,20 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.BasicTopicContextFunctionalityType -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RecWithEducationTopicContextFunctionalityType -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.RecommendationTopicContextFunctionalityType -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.TopicContextFunctionalityType -import com.twitter.timelines.render.{thriftscala => urt} - -object TopicContextFunctionalityTypeMarshaller { - - def apply( - topicContextFunctionalityType: TopicContextFunctionalityType - ): urt.TopicContextFunctionalityType = topicContextFunctionalityType match { - case BasicTopicContextFunctionalityType => urt.TopicContextFunctionalityType.Basic - case RecommendationTopicContextFunctionalityType => - urt.TopicContextFunctionalityType.Recommendation - case RecWithEducationTopicContextFunctionalityType => - urt.TopicContextFunctionalityType.RecWithEducation - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TopicContextMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TopicContextMarshaller.docx new file mode 100644 index 000000000..f78937f3d Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TopicContextMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TopicContextMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TopicContextMarshaller.scala deleted file mode 100644 index 0c067e299..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/TopicContextMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.BasicTopicContextFunctionalityType -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.TopicContext -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TopicContextMarshaller @Inject() () { - - def apply(topicContext: TopicContext): urt.SocialContext = { - urt.SocialContext.TopicContext( - urt.TopicContext( - topicId = topicContext.topicId, - functionalityType = TopicContextFunctionalityTypeMarshaller( - topicContext.functionalityType.getOrElse(BasicTopicContextFunctionalityType)) - ) - ) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrlMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrlMarshaller.docx new file mode 100644 index 000000000..d87d2e2ad Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrlMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrlMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrlMarshaller.scala deleted file mode 100644 index 65c8ba30d..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrlMarshaller.scala +++ /dev/null @@ -1,18 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.Url -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class UrlMarshaller @Inject() ( - urlTypeMarshaller: UrlTypeMarshaller, - urtEndpointOptionsMarshaller: UrtEndpointOptionsMarshaller) { - - def apply(url: Url): urt.Url = urt.Url( - urlType = urlTypeMarshaller(url.urlType), - url = url.url, - urtEndpointOptions = url.urtEndpointOptions.map(urtEndpointOptionsMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrlTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrlTypeMarshaller.docx new file mode 100644 index 000000000..29c7ba066 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrlTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrlTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrlTypeMarshaller.scala deleted file mode 100644 index 4d2796535..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrlTypeMarshaller.scala +++ /dev/null @@ -1,19 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.DeepLink -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ExternalUrl -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.UrlType -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.UrtEndpoint -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class UrlTypeMarshaller @Inject() () { - - def apply(urlType: UrlType): urt.UrlType = urlType match { - case ExternalUrl => urt.UrlType.ExternalUrl - case DeepLink => urt.UrlType.DeepLink - case UrtEndpoint => urt.UrlType.UrtEndpoint - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrtEndpointOptionsMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrtEndpointOptionsMarshaller.docx new file mode 100644 index 000000000..18599739d Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrtEndpointOptionsMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrtEndpointOptionsMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrtEndpointOptionsMarshaller.scala deleted file mode 100644 index d9d5c80ce..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata/UrtEndpointOptionsMarshaller.scala +++ /dev/null @@ -1,18 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.UrtEndpointOptions -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class UrtEndpointOptionsMarshaller @Inject() () { - - def apply(urtEndpointOptions: UrtEndpointOptions): urt.UrtEndpointOptions = - urt.UrtEndpointOptions( - requestParams = urtEndpointOptions.requestParams, - title = urtEndpointOptions.title, - cacheId = urtEndpointOptions.cacheId, - subtitle = urtEndpointOptions.subtitle - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/BUILD deleted file mode 100644 index 7d10b934c..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/BUILD +++ /dev/null @@ -1,17 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/operation", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], - exports = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/operation", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/BUILD.docx new file mode 100644 index 000000000..37d65a549 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorDisplayTreatmentMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorDisplayTreatmentMarshaller.docx new file mode 100644 index 000000000..e98369ceb Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorDisplayTreatmentMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorDisplayTreatmentMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorDisplayTreatmentMarshaller.scala deleted file mode 100644 index 881891183..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorDisplayTreatmentMarshaller.scala +++ /dev/null @@ -1,16 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.operation - -import com.twitter.product_mixer.core.model.marshalling.response.urt.operation.CursorDisplayTreatment -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class CursorDisplayTreatmentMarshaller @Inject() () { - - def apply(treatment: CursorDisplayTreatment): urt.CursorDisplayTreatment = - urt.CursorDisplayTreatment( - actionText = treatment.actionText, - labelText = treatment.labelText - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorItemMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorItemMarshaller.docx new file mode 100644 index 000000000..ab95437a1 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorItemMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorItemMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorItemMarshaller.scala deleted file mode 100644 index 00d83fad1..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorItemMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.operation - -import com.twitter.product_mixer.core.model.marshalling.response.urt.operation.CursorItem -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class CursorItemMarshaller @Inject() ( - cursorTypeMarshaller: CursorTypeMarshaller, - cursorDisplayTreatmentMarshaller: CursorDisplayTreatmentMarshaller) { - - def apply(cursorItem: CursorItem): urt.TimelineItemContent.TimelineCursor = - urt.TimelineItemContent.TimelineCursor( - urt.TimelineCursor( - value = cursorItem.value, - cursorType = cursorTypeMarshaller(cursorItem.cursorType), - displayTreatment = cursorItem.displayTreatment.map(cursorDisplayTreatmentMarshaller(_)) - ) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorOperationMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorOperationMarshaller.docx new file mode 100644 index 000000000..7ac01d2e2 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorOperationMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorOperationMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorOperationMarshaller.scala deleted file mode 100644 index fedf19c65..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorOperationMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.operation - -import com.twitter.product_mixer.core.model.marshalling.response.urt.operation.CursorOperation -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class CursorOperationMarshaller @Inject() ( - cursorTypeMarshaller: CursorTypeMarshaller, - cursorDisplayTreatmentMarshaller: CursorDisplayTreatmentMarshaller) { - - def apply(cursorOperation: CursorOperation): urt.TimelineOperation.Cursor = - urt.TimelineOperation.Cursor( - urt.TimelineCursor( - value = cursorOperation.value, - cursorType = cursorTypeMarshaller(cursorOperation.cursorType), - displayTreatment = cursorOperation.displayTreatment.map(cursorDisplayTreatmentMarshaller(_)) - ) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorTypeMarshaller.docx new file mode 100644 index 000000000..c964c8013 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorTypeMarshaller.scala deleted file mode 100644 index 9359b069c..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/operation/CursorTypeMarshaller.scala +++ /dev/null @@ -1,38 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.operation - -import com.twitter.product_mixer.core.model.marshalling.response.urt.operation._ -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class CursorTypeMarshaller @Inject() () { - - def apply(cursorType: CursorType): urt.CursorType = cursorType match { - case TopCursor => urt.CursorType.Top - case BottomCursor => urt.CursorType.Bottom - case GapCursor => urt.CursorType.Gap - case PivotCursor => urt.CursorType.Pivot - case SubBranchCursor => urt.CursorType.Subbranch - case ShowMoreCursor => urt.CursorType.ShowMore - case ShowMoreThreadsCursor => urt.CursorType.ShowMoreThreads - case ShowMoreThreadsPromptCursor => urt.CursorType.ShowMoreThreadsPrompt - case SecondRepliesSectionCursor => urt.CursorType.SecondRepliesSection - case ThirdRepliesSectionCursor => urt.CursorType.ThirdRepliesSection - } - - def unmarshall(cursorType: urt.CursorType): CursorType = cursorType match { - case urt.CursorType.Top => TopCursor - case urt.CursorType.Bottom => BottomCursor - case urt.CursorType.Gap => GapCursor - case urt.CursorType.Pivot => PivotCursor - case urt.CursorType.Subbranch => SubBranchCursor - case urt.CursorType.ShowMore => ShowMoreCursor - case urt.CursorType.ShowMoreThreads => ShowMoreThreadsCursor - case urt.CursorType.ShowMoreThreadsPrompt => ShowMoreThreadsPromptCursor - case urt.CursorType.SecondRepliesSection => SecondRepliesSectionCursor - case urt.CursorType.ThirdRepliesSection => ThirdRepliesSectionCursor - case urt.CursorType.EnumUnknownCursorType(id) => - throw new UnsupportedOperationException(s"Unexpected cursor enum field: $id") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/AdMetadataContainerMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/AdMetadataContainerMarshaller.docx new file mode 100644 index 000000000..ed99cfb3c Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/AdMetadataContainerMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/AdMetadataContainerMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/AdMetadataContainerMarshaller.scala deleted file mode 100644 index e525e3495..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/AdMetadataContainerMarshaller.scala +++ /dev/null @@ -1,26 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.AdMetadataContainer -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class AdMetadataContainerMarshaller @Inject() ( - sponsorshipTypeMarshaller: SponsorshipTypeMarshaller, - disclaimerTypeMarshaller: DisclaimerTypeMarshaller, - skAdNetworkDataMarshaller: SkAdNetworkDataMarshaller) { - - def apply(adMetadataContainer: AdMetadataContainer): urt.AdMetadataContainer = - urt.AdMetadataContainer( - removePromotedAttributionForPreroll = adMetadataContainer.removePromotedAttributionForPreroll, - sponsorshipCandidate = adMetadataContainer.sponsorshipCandidate, - sponsorshipOrganization = adMetadataContainer.sponsorshipOrganization, - sponsorshipOrganizationWebsite = adMetadataContainer.sponsorshipOrganizationWebsite, - sponsorshipType = adMetadataContainer.sponsorshipType.map(sponsorshipTypeMarshaller(_)), - disclaimerType = adMetadataContainer.disclaimerType.map(disclaimerTypeMarshaller(_)), - skAdNetworkDataList = - adMetadataContainer.skAdNetworkDataList.map(_.map(skAdNetworkDataMarshaller(_))), - unifiedCardOverride = adMetadataContainer.unifiedCardOverride - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/BUILD deleted file mode 100644 index 6ac0230f9..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/BUILD +++ /dev/null @@ -1,17 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], - exports = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/BUILD.docx new file mode 100644 index 000000000..2d0d71751 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/CallToActionMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/CallToActionMarshaller.docx new file mode 100644 index 000000000..0ca31bd98 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/CallToActionMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/CallToActionMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/CallToActionMarshaller.scala deleted file mode 100644 index 5c55b1a59..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/CallToActionMarshaller.scala +++ /dev/null @@ -1,15 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.CallToAction -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Singleton - -@Singleton -class CallToActionMarshaller { - def apply(callToAction: CallToAction): urt.CallToAction = { - urt.CallToAction( - callToActionType = callToAction.callToActionType, - url = callToAction.url - ) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/ClickTrackingInfoMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/ClickTrackingInfoMarshaller.docx new file mode 100644 index 000000000..fffa1ce37 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/ClickTrackingInfoMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/ClickTrackingInfoMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/ClickTrackingInfoMarshaller.scala deleted file mode 100644 index c174b4107..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/ClickTrackingInfoMarshaller.scala +++ /dev/null @@ -1,18 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.ClickTrackingInfo -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ClickTrackingInfoMarshaller @Inject() ( - urlOverrideTypeMarshaller: UrlOverrideTypeMarshaller) { - - def apply(clickTrackingInfo: ClickTrackingInfo): urt.ClickTrackingInfo = - urt.ClickTrackingInfo( - urlParams = clickTrackingInfo.urlParams, - urlOverride = clickTrackingInfo.urlOverride, - urlOverrideType = clickTrackingInfo.urlOverrideType.map(urlOverrideTypeMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DisclaimerTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DisclaimerTypeMarshaller.docx new file mode 100644 index 000000000..66f7d2787 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DisclaimerTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DisclaimerTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DisclaimerTypeMarshaller.scala deleted file mode 100644 index 764eefa04..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DisclaimerTypeMarshaller.scala +++ /dev/null @@ -1,17 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.DisclaimerIssue -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.DisclaimerPolitical -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.DisclaimerType -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class DisclaimerTypeMarshaller @Inject() () { - - def apply(disclaimerType: DisclaimerType): urt.DisclaimerType = disclaimerType match { - case DisclaimerPolitical => urt.DisclaimerType.Political - case DisclaimerIssue => urt.DisclaimerType.Issue - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DisclosureTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DisclosureTypeMarshaller.docx new file mode 100644 index 000000000..6f7d590b9 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DisclosureTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DisclosureTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DisclosureTypeMarshaller.scala deleted file mode 100644 index dfabdd6d9..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DisclosureTypeMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.DisclosureType -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.Earned -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.Issue -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.NoDisclosure -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.Political -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class DisclosureTypeMarshaller @Inject() () { - - def apply(disclosureType: DisclosureType): urt.DisclosureType = disclosureType match { - case NoDisclosure => urt.DisclosureType.NoDisclosure - case Political => urt.DisclosureType.Political - case Earned => urt.DisclosureType.Earned - case Issue => urt.DisclosureType.Issue - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DynamicPrerollTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DynamicPrerollTypeMarshaller.docx new file mode 100644 index 000000000..4391c5650 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DynamicPrerollTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DynamicPrerollTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DynamicPrerollTypeMarshaller.scala deleted file mode 100644 index f009b89a3..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/DynamicPrerollTypeMarshaller.scala +++ /dev/null @@ -1,20 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.Amplify -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.DynamicPrerollType -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.LiveTvEvent -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.Marketplace -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class DynamicPrerollTypeMarshaller @Inject() () { - - def apply(dynamicPrerollType: DynamicPrerollType): urt.DynamicPrerollType = - dynamicPrerollType match { - case Amplify => urt.DynamicPrerollType.Amplify - case Marketplace => urt.DynamicPrerollType.Marketplace - case LiveTvEvent => urt.DynamicPrerollType.LiveTvEvent - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/MediaInfoMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/MediaInfoMarshaller.docx new file mode 100644 index 000000000..e15ffda89 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/MediaInfoMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/MediaInfoMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/MediaInfoMarshaller.scala deleted file mode 100644 index e9ce5b414..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/MediaInfoMarshaller.scala +++ /dev/null @@ -1,24 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.MediaInfo -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class MediaInfoMarshaller @Inject() ( - callToActionMarshaller: CallToActionMarshaller, - videoVariantsMarshaller: VideoVariantsMarshaller) { - def apply(mediaInfo: MediaInfo): urt.MediaInfo = { - urt.MediaInfo( - uuid = mediaInfo.uuid, - publisherId = mediaInfo.publisherId, - callToAction = mediaInfo.callToAction.map(callToActionMarshaller(_)), - durationMillis = mediaInfo.durationMillis, - videoVariants = mediaInfo.videoVariants.map(videoVariantsMarshaller(_)), - advertiserName = mediaInfo.advertiserName, - renderAdByAdvertiserName = mediaInfo.renderAdByAdvertiserName, - advertiserProfileImageUrl = mediaInfo.advertiserProfileImageUrl - ) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PrerollMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PrerollMarshaller.docx new file mode 100644 index 000000000..6242b11ae Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PrerollMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PrerollMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PrerollMarshaller.scala deleted file mode 100644 index 184540489..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PrerollMarshaller.scala +++ /dev/null @@ -1,19 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.Preroll -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class PrerollMarshaller @Inject() ( - dynamicPrerollTypeMarshaller: DynamicPrerollTypeMarshaller, - mediaInfoMarshaller: MediaInfoMarshaller) { - - def apply(preroll: Preroll): urt.Preroll = - urt.Preroll( - prerollId = preroll.prerollId, - dynamicPrerollType = preroll.dynamicPrerollType.map(dynamicPrerollTypeMarshaller(_)), - mediaInfo = preroll.mediaInfo.map(mediaInfoMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PrerollMetadataMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PrerollMetadataMarshaller.docx new file mode 100644 index 000000000..6639559dc Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PrerollMetadataMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PrerollMetadataMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PrerollMetadataMarshaller.scala deleted file mode 100644 index 65197a8cd..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PrerollMetadataMarshaller.scala +++ /dev/null @@ -1,16 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.PrerollMetadata -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class PrerollMetadataMarshaller @Inject() ( - prerollMarshaller: PrerollMarshaller) { - def apply(prerollMetadata: PrerollMetadata): urt.PrerollMetadata = - urt.PrerollMetadata( - preroll = prerollMetadata.preroll.map(prerollMarshaller(_)), - videoAnalyticsScribePassthrough = prerollMetadata.videoAnalyticsScribePassthrough - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PromotedMetadataMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PromotedMetadataMarshaller.docx new file mode 100644 index 000000000..ee8ea370e Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PromotedMetadataMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PromotedMetadataMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PromotedMetadataMarshaller.scala deleted file mode 100644 index 6a1e1750e..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/PromotedMetadataMarshaller.scala +++ /dev/null @@ -1,35 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.PromotedMetadata -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class PromotedMetadataMarshaller @Inject() ( - disclosureTypeMarshaller: DisclosureTypeMarshaller, - adMetadataContainerMarshaller: AdMetadataContainerMarshaller, - clickTrackingInfoMarshaller: ClickTrackingInfoMarshaller) { - - /** See comments on [[com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.PromotedMetadata]] - * regarding impressionId and impressionString - * - * TL;DR the domain model only has impressionString (the newer version) an this marshaller sets both - * impressionId (the older) and impressionString based on it for compatibility. - * */ - def apply(promotedMetadata: PromotedMetadata): urt.PromotedMetadata = - urt.PromotedMetadata( - advertiserId = promotedMetadata.advertiserId, - impressionId = promotedMetadata.impressionString, - disclosureType = promotedMetadata.disclosureType.map(disclosureTypeMarshaller(_)), - experimentValues = promotedMetadata.experimentValues, - promotedTrendId = promotedMetadata.promotedTrendId, - promotedTrendName = promotedMetadata.promotedTrendName, - promotedTrendQueryTerm = promotedMetadata.promotedTrendQueryTerm, - adMetadataContainer = - promotedMetadata.adMetadataContainer.map(adMetadataContainerMarshaller(_)), - promotedTrendDescription = promotedMetadata.promotedTrendDescription, - impressionString = promotedMetadata.impressionString, - clickTrackingInfo = promotedMetadata.clickTrackingInfo.map(clickTrackingInfoMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/SkAdNetworkDataMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/SkAdNetworkDataMarshaller.docx new file mode 100644 index 000000000..5b1423814 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/SkAdNetworkDataMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/SkAdNetworkDataMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/SkAdNetworkDataMarshaller.scala deleted file mode 100644 index cd1813508..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/SkAdNetworkDataMarshaller.scala +++ /dev/null @@ -1,23 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.SkAdNetworkData -import javax.inject.Inject -import javax.inject.Singleton -import com.twitter.timelines.render.{thriftscala => urt} - -@Singleton -class SkAdNetworkDataMarshaller @Inject() () { - - def apply(skAdNetworkData: SkAdNetworkData): urt.SkAdNetworkData = - urt.SkAdNetworkData( - version = skAdNetworkData.version, - srcAppId = skAdNetworkData.srcAppId, - dstAppId = skAdNetworkData.dstAppId, - adNetworkId = skAdNetworkData.adNetworkId, - campaignId = skAdNetworkData.campaignId, - impressionTimeInMillis = skAdNetworkData.impressionTimeInMillis, - nonce = skAdNetworkData.nonce, - signature = skAdNetworkData.signature, - fidelityType = skAdNetworkData.fidelityType - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/SponsorshipTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/SponsorshipTypeMarshaller.docx new file mode 100644 index 000000000..18a1a4edc Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/SponsorshipTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/SponsorshipTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/SponsorshipTypeMarshaller.scala deleted file mode 100644 index 7c892eef1..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/SponsorshipTypeMarshaller.scala +++ /dev/null @@ -1,19 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.DirectSponsorshipType -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.IndirectSponsorshipType -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.NoSponsorshipSponsorshipType -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.SponsorshipType -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class SponsorshipTypeMarshaller @Inject() () { - - def apply(sponsorshipType: SponsorshipType): urt.SponsorshipType = sponsorshipType match { - case DirectSponsorshipType => urt.SponsorshipType.Direct - case IndirectSponsorshipType => urt.SponsorshipType.Indirect - case NoSponsorshipSponsorshipType => urt.SponsorshipType.NoSponsorship - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/UrlOverrideTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/UrlOverrideTypeMarshaller.docx new file mode 100644 index 000000000..7f4070ab9 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/UrlOverrideTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/UrlOverrideTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/UrlOverrideTypeMarshaller.scala deleted file mode 100644 index ea76457c1..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/UrlOverrideTypeMarshaller.scala +++ /dev/null @@ -1,17 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.DcmUrlOverrideType -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.UnknownUrlOverrideType -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.UrlOverrideType -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class UrlOverrideTypeMarshaller @Inject() () { - - def apply(urlOverrideType: UrlOverrideType): urt.UrlOverrideType = urlOverrideType match { - case UnknownUrlOverrideType => urt.UrlOverrideType.Unknown - case DcmUrlOverrideType => urt.UrlOverrideType.Dcm - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/VideoVariantsMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/VideoVariantsMarshaller.docx new file mode 100644 index 000000000..38f81c49b Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/VideoVariantsMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/VideoVariantsMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/VideoVariantsMarshaller.scala deleted file mode 100644 index d3ab9188d..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/promoted/VideoVariantsMarshaller.scala +++ /dev/null @@ -1,17 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.promoted - -import com.twitter.product_mixer.core.model.marshalling.response.urt.promoted.VideoVariant -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Singleton - -@Singleton -class VideoVariantsMarshaller { - def apply(videoVariants: Seq[VideoVariant]): Seq[urt.VideoVariant] = { - videoVariants.map(videoVariant => - urt.VideoVariant( - url = videoVariant.url, - contentType = videoVariant.contentType, - bitrate = videoVariant.bitrate - )) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/reaction/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/reaction/BUILD deleted file mode 100644 index 527e20c0c..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/reaction/BUILD +++ /dev/null @@ -1,17 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/reaction", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], - exports = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/reaction", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/reaction/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/reaction/BUILD.docx new file mode 100644 index 000000000..f2ea207d7 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/reaction/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/reaction/TimelineReactionMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/reaction/TimelineReactionMarshaller.docx new file mode 100644 index 000000000..0d92f3bae Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/reaction/TimelineReactionMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/reaction/TimelineReactionMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/reaction/TimelineReactionMarshaller.scala deleted file mode 100644 index 56a2d53ad..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/reaction/TimelineReactionMarshaller.scala +++ /dev/null @@ -1,28 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.reaction - -import com.twitter.product_mixer.core.model.marshalling.response.urt.reaction.ImmediateTimelineReaction -import com.twitter.product_mixer.core.model.marshalling.response.urt.reaction.RemoteTimelineReaction -import com.twitter.product_mixer.core.model.marshalling.response.urt.reaction.TimelineReaction -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class TimelineReactionMarshaller @Inject() () { - def apply(timelineReaction: TimelineReaction): urt.TimelineReaction = { - val execution = timelineReaction.execution match { - case ImmediateTimelineReaction(key) => - urt.TimelineReactionExecution.Immediate(urt.ImmediateTimelineReaction(key)) - case RemoteTimelineReaction(requestParams, timeoutInSeconds) => - urt.TimelineReactionExecution.Remote( - urt.RemoteTimelineReaction( - requestParams, - timeoutInSeconds - )) - } - urt.TimelineReaction( - execution = execution, - maxExecutionCount = timelineReaction.maxExecutionCount - ) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/BUILD deleted file mode 100644 index cdc73d8c4..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/BUILD +++ /dev/null @@ -1,21 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/richtext", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], - exports = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/richtext", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/BUILD.docx new file mode 100644 index 000000000..912ac30c8 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/ReferenceObjectMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/ReferenceObjectMarshaller.docx new file mode 100644 index 000000000..fd5c77848 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/ReferenceObjectMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/ReferenceObjectMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/ReferenceObjectMarshaller.scala deleted file mode 100644 index 217b9d9d1..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/ReferenceObjectMarshaller.scala +++ /dev/null @@ -1,31 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.richtext - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.UrlMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.Url -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.ReferenceObject -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.RichTextCashtag -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.RichTextHashtag -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.RichTextList -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.RichTextMention -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.RichTextUser -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ReferenceObjectMarshaller @Inject() (urlMarshaller: UrlMarshaller) { - - def apply(ref: ReferenceObject): urt.ReferenceObject = ref match { - case url: Url => urt.ReferenceObject.Url(urlMarshaller(url)) - case user: RichTextUser => urt.ReferenceObject.User(urt.RichTextUser(id = user.id)) - case mention: RichTextMention => - urt.ReferenceObject.Mention( - urt.RichTextMention(id = mention.id, screenName = mention.screenName)) - case hashtag: RichTextHashtag => - urt.ReferenceObject.Hashtag(urt.RichTextHashtag(text = hashtag.text)) - case cashtag: RichTextCashtag => - urt.ReferenceObject.Cashtag(urt.RichTextCashtag(text = cashtag.text)) - case twitterList: RichTextList => - urt.ReferenceObject.TwitterList(urt.RichTextList(id = twitterList.id, url = twitterList.url)) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextAlignmentMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextAlignmentMarshaller.docx new file mode 100644 index 000000000..c92e2c343 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextAlignmentMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextAlignmentMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextAlignmentMarshaller.scala deleted file mode 100644 index 24bbf07af..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextAlignmentMarshaller.scala +++ /dev/null @@ -1,17 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.richtext - -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.Center -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.Natural -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.RichTextAlignment -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class RichTextAlignmentMarshaller @Inject() () { - - def apply(alignment: RichTextAlignment): urt.RichTextAlignment = alignment match { - case Natural => urt.RichTextAlignment.Natural - case Center => urt.RichTextAlignment.Center - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextEntityMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextEntityMarshaller.docx new file mode 100644 index 000000000..c948fb13e Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextEntityMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextEntityMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextEntityMarshaller.scala deleted file mode 100644 index a2c7d2a6d..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextEntityMarshaller.scala +++ /dev/null @@ -1,19 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.richtext - -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.RichTextEntity -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class RichTextEntityMarshaller @Inject() ( - referenceObjectMarshaller: ReferenceObjectMarshaller, - richTextFormatMarshaller: RichTextFormatMarshaller) { - - def apply(entity: RichTextEntity): urt.RichTextEntity = urt.RichTextEntity( - fromIndex = entity.fromIndex, - toIndex = entity.toIndex, - ref = entity.ref.map(referenceObjectMarshaller(_)), - format = entity.format.map(richTextFormatMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextFormatMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextFormatMarshaller.docx new file mode 100644 index 000000000..78c21776b Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextFormatMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextFormatMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextFormatMarshaller.scala deleted file mode 100644 index cd24a4013..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextFormatMarshaller.scala +++ /dev/null @@ -1,17 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.richtext - -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.Plain -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.RichTextFormat -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.Strong -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class RichTextFormatMarshaller @Inject() () { - - def apply(format: RichTextFormat): urt.RichTextFormat = format match { - case Plain => urt.RichTextFormat.Plain - case Strong => urt.RichTextFormat.Strong - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextMarshaller.docx new file mode 100644 index 000000000..30d982241 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextMarshaller.scala deleted file mode 100644 index a86b90fd4..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/richtext/RichTextMarshaller.scala +++ /dev/null @@ -1,19 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.richtext - -import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.RichText -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class RichTextMarshaller @Inject() ( - richTextEntityMarshaller: RichTextEntityMarshaller, - richTextAlignmentMarshaller: RichTextAlignmentMarshaller) { - - def apply(richText: RichText): urt.RichText = urt.RichText( - text = richText.text, - entities = richText.entities.map(richTextEntityMarshaller(_)), - rtl = richText.rtl, - alignment = richText.alignment.map(richTextAlignmentMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/AdsMetadataMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/AdsMetadataMarshaller.docx new file mode 100644 index 000000000..beb52e376 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/AdsMetadataMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/AdsMetadataMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/AdsMetadataMarshaller.scala deleted file mode 100644 index 9dda91373..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/AdsMetadataMarshaller.scala +++ /dev/null @@ -1,13 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.timeline_module - -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.AdsMetadata -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class AdsMetadataMarshaller @Inject() () { - - def apply(adsMetadata: AdsMetadata): urt.AdsMetadata = - urt.AdsMetadata(carouselId = adsMetadata.carouselId) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/BUILD deleted file mode 100644 index 04000837b..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/BUILD +++ /dev/null @@ -1,19 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/timeline_module", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], - exports = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/metadata", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/timeline_module", - "src/thrift/com/twitter/timelines/render:thrift-scala", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/BUILD.docx new file mode 100644 index 000000000..b6a0e19bd Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/GridCarouselMetadataMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/GridCarouselMetadataMarshaller.docx new file mode 100644 index 000000000..c8854ef6a Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/GridCarouselMetadataMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/GridCarouselMetadataMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/GridCarouselMetadataMarshaller.scala deleted file mode 100644 index d86cb0462..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/GridCarouselMetadataMarshaller.scala +++ /dev/null @@ -1,13 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.timeline_module - -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.GridCarouselMetadata -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class GridCarouselMetadataMarshaller @Inject() () { - - def apply(gridCarouselMetadata: GridCarouselMetadata): urt.GridCarouselMetadata = - urt.GridCarouselMetadata(numRows = gridCarouselMetadata.numRows) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleConversationMetadataMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleConversationMetadataMarshaller.docx new file mode 100644 index 000000000..d3d522d94 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleConversationMetadataMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleConversationMetadataMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleConversationMetadataMarshaller.scala deleted file mode 100644 index b816f91e8..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleConversationMetadataMarshaller.scala +++ /dev/null @@ -1,20 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.timeline_module - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.SocialContextMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.ModuleConversationMetadata -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ModuleConversationMetadataMarshaller @Inject() ( - socialContextMarshaller: SocialContextMarshaller) { - - def apply( - moduleConversationMetadata: ModuleConversationMetadata - ): urt.ModuleConversationMetadata = urt.ModuleConversationMetadata( - allTweetIds = moduleConversationMetadata.allTweetIds, - socialContext = moduleConversationMetadata.socialContext.map(socialContextMarshaller(_)), - enableDeduplication = moduleConversationMetadata.enableDeduplication - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleDisplayTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleDisplayTypeMarshaller.docx new file mode 100644 index 000000000..58378f72c Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleDisplayTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleDisplayTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleDisplayTypeMarshaller.scala deleted file mode 100644 index e2ce757f4..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleDisplayTypeMarshaller.scala +++ /dev/null @@ -1,29 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.timeline_module - -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.Carousel -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.CompactCarousel -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.ConversationTree -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.GridCarousel -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.ModuleDisplayType -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.Vertical -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.VerticalConversation -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.VerticalWithContextLine -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.VerticalGrid -import javax.inject.Inject -import javax.inject.Singleton -import com.twitter.timelines.render.{thriftscala => urt} - -@Singleton -class ModuleDisplayTypeMarshaller @Inject() () { - - def apply(displayType: ModuleDisplayType): urt.ModuleDisplayType = displayType match { - case Vertical => urt.ModuleDisplayType.Vertical - case Carousel => urt.ModuleDisplayType.Carousel - case VerticalWithContextLine => urt.ModuleDisplayType.VerticalWithContextLine - case VerticalConversation => urt.ModuleDisplayType.VerticalConversation - case ConversationTree => urt.ModuleDisplayType.ConversationTree - case GridCarousel => urt.ModuleDisplayType.GridCarousel - case CompactCarousel => urt.ModuleDisplayType.CompactCarousel - case VerticalGrid => urt.ModuleDisplayType.VerticalGrid - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleFooterMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleFooterMarshaller.docx new file mode 100644 index 000000000..72ff6a41e Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleFooterMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleFooterMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleFooterMarshaller.scala deleted file mode 100644 index d7d485fd9..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleFooterMarshaller.scala +++ /dev/null @@ -1,16 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.timeline_module - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.UrlMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.ModuleFooter -import javax.inject.Inject -import javax.inject.Singleton -import com.twitter.timelines.render.{thriftscala => urt} - -@Singleton -class ModuleFooterMarshaller @Inject() (urlMarshaller: UrlMarshaller) { - - def apply(footer: ModuleFooter): urt.ModuleFooter = urt.ModuleFooter( - text = footer.text, - landingUrl = footer.landingUrl.map(urlMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleHeaderDisplayTypeMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleHeaderDisplayTypeMarshaller.docx new file mode 100644 index 000000000..369650978 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleHeaderDisplayTypeMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleHeaderDisplayTypeMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleHeaderDisplayTypeMarshaller.scala deleted file mode 100644 index 32cc5dc32..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleHeaderDisplayTypeMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.timeline_module - -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.Classic -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.ClassicNoDivider -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.ContextEmphasis -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.ModuleHeaderDisplayType -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ModuleHeaderDisplayTypeMarshaller @Inject() () { - - def apply(displayType: ModuleHeaderDisplayType): urt.ModuleHeaderDisplayType = - displayType match { - case Classic => urt.ModuleHeaderDisplayType.Classic - case ContextEmphasis => urt.ModuleHeaderDisplayType.ContextEmphasis - case ClassicNoDivider => urt.ModuleHeaderDisplayType.ClassicNoDivider - } - -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleHeaderMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleHeaderMarshaller.docx new file mode 100644 index 000000000..09b956d8c Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleHeaderMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleHeaderMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleHeaderMarshaller.scala deleted file mode 100644 index 05ab3a13a..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleHeaderMarshaller.scala +++ /dev/null @@ -1,26 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.timeline_module - -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.icon.HorizonIconMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.ImageVariantMarshaller -import com.twitter.product_mixer.core.functional_component.marshaller.response.urt.metadata.SocialContextMarshaller -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.ModuleHeader -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ModuleHeaderMarshaller @Inject() ( - horizonIconMarshaller: HorizonIconMarshaller, - imageVariantMarshaller: ImageVariantMarshaller, - socialContextMarshaller: SocialContextMarshaller, - moduleHeaderDisplayTypeMarshaller: ModuleHeaderDisplayTypeMarshaller) { - - def apply(header: ModuleHeader): urt.ModuleHeader = urt.ModuleHeader( - text = header.text, - sticky = header.sticky, - icon = header.icon.map(horizonIconMarshaller(_)), - customIcon = header.customIcon.map(imageVariantMarshaller(_)), - socialContext = header.socialContext.map(socialContextMarshaller(_)), - displayType = moduleHeaderDisplayTypeMarshaller(header.moduleHeaderDisplayType) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleMetadataMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleMetadataMarshaller.docx new file mode 100644 index 000000000..8e769c5a4 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleMetadataMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleMetadataMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleMetadataMarshaller.scala deleted file mode 100644 index 8c6154186..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleMetadataMarshaller.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.timeline_module - -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.ModuleMetadata -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ModuleMetadataMarshaller @Inject() ( - adsMetadataMarshaller: AdsMetadataMarshaller, - moduleConversationMetadataMarshaller: ModuleConversationMetadataMarshaller, - gridCarouselMetadataMarshaller: GridCarouselMetadataMarshaller) { - - def apply(moduleMetadata: ModuleMetadata): urt.ModuleMetadata = urt.ModuleMetadata( - adsMetadata = moduleMetadata.adsMetadata.map(adsMetadataMarshaller(_)), - conversationMetadata = - moduleMetadata.conversationMetadata.map(moduleConversationMetadataMarshaller(_)), - gridCarouselMetadata = - moduleMetadata.gridCarouselMetadata.map(gridCarouselMetadataMarshaller(_)) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleShowMoreBehaviorMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleShowMoreBehaviorMarshaller.docx new file mode 100644 index 000000000..d6828e885 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleShowMoreBehaviorMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleShowMoreBehaviorMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleShowMoreBehaviorMarshaller.scala deleted file mode 100644 index f0df20b3b..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleShowMoreBehaviorMarshaller.scala +++ /dev/null @@ -1,19 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.timeline_module - -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.ModuleShowMoreBehavior -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.ModuleShowMoreBehaviorRevealByCount -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ModuleShowMoreBehaviorMarshaller @Inject() ( - moduleShowMoreBehaviorRevealByCountMarshaller: ModuleShowMoreBehaviorRevealByCountMarshaller) { - - def apply( - moduleShowMoreBehavior: ModuleShowMoreBehavior - ): urt.ModuleShowMoreBehavior = moduleShowMoreBehavior match { - case moduleShowMoreBehaviorRevealByCount: ModuleShowMoreBehaviorRevealByCount => - moduleShowMoreBehaviorRevealByCountMarshaller(moduleShowMoreBehaviorRevealByCount) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleShowMoreBehaviorRevealByCountMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleShowMoreBehaviorRevealByCountMarshaller.docx new file mode 100644 index 000000000..c0c86cd6b Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleShowMoreBehaviorRevealByCountMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleShowMoreBehaviorRevealByCountMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleShowMoreBehaviorRevealByCountMarshaller.scala deleted file mode 100644 index 1d36e979e..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/marshaller/response/urt/timeline_module/ModuleShowMoreBehaviorRevealByCountMarshaller.scala +++ /dev/null @@ -1,20 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.marshaller.response.urt.timeline_module - -import com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module.ModuleShowMoreBehaviorRevealByCount -import com.twitter.timelines.render.{thriftscala => urt} -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class ModuleShowMoreBehaviorRevealByCountMarshaller @Inject() () { - - def apply( - moduleShowMoreBehaviorRevealByCount: ModuleShowMoreBehaviorRevealByCount - ): urt.ModuleShowMoreBehavior = - urt.ModuleShowMoreBehavior.RevealByCount( - urt.ModuleShowMoreBehaviorRevealByCount( - initialItemsCount = moduleShowMoreBehaviorRevealByCount.initialItemsCount, - showMoreItemsCount = moduleShowMoreBehaviorRevealByCount.showMoreItemsCount - ) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/premarshaller/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/premarshaller/BUILD deleted file mode 100644 index a5bd6af7e..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/premarshaller/BUILD +++ /dev/null @@ -1,17 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline", - ], - exports = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/premarshaller/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/premarshaller/BUILD.docx new file mode 100644 index 000000000..961888344 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/premarshaller/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/premarshaller/DomainMarshaller.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/premarshaller/DomainMarshaller.docx new file mode 100644 index 000000000..8b8e248c7 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/premarshaller/DomainMarshaller.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/premarshaller/DomainMarshaller.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/premarshaller/DomainMarshaller.scala deleted file mode 100644 index ea027f086..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/premarshaller/DomainMarshaller.scala +++ /dev/null @@ -1,66 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.premarshaller - -import com.twitter.product_mixer.core.functional_component.marshaller.TransportMarshaller -import com.twitter.product_mixer.core.model.common.Component -import com.twitter.product_mixer.core.model.common.identifier.ComponentIdentifier -import com.twitter.product_mixer.core.model.common.identifier.DomainMarshallerIdentifier -import com.twitter.product_mixer.core.model.common.presentation.CandidateWithDetails -import com.twitter.product_mixer.core.model.common.presentation.ModulePresentation -import com.twitter.product_mixer.core.model.common.presentation.UniversalPresentation -import com.twitter.product_mixer.core.pipeline.PipelineQuery - -/** - * Transforms the `selections` into a [[DomainResponseType]] object (often URT, Slice, etc) - * - * [[DomainMarshaller]]s may contain business logic - * - * @note This is different from `com.twitter.product_mixer.core.marshaller`s - * which transforms into a wire-compatible type - */ -trait DomainMarshaller[-Query <: PipelineQuery, DomainResponseType] extends Component { - - override val identifier: DomainMarshallerIdentifier - - /** Transforms the `selections` into a [[DomainResponseType]] object */ - def apply( - query: Query, - selections: Seq[CandidateWithDetails] - ): DomainResponseType -} - -class UnsupportedCandidateDomainMarshallerException( - candidate: Any, - candidateSource: ComponentIdentifier) - extends UnsupportedOperationException( - s"Domain marshaller does not support candidate ${TransportMarshaller.getSimpleName( - candidate.getClass)} from source $candidateSource") - -class UndecoratedCandidateDomainMarshallerException( - candidate: Any, - candidateSource: ComponentIdentifier) - extends UnsupportedOperationException( - s"Domain marshaller does not support undecorated candidate ${TransportMarshaller - .getSimpleName(candidate.getClass)} from source $candidateSource") - -class UnsupportedPresentationDomainMarshallerException( - candidate: Any, - presentation: UniversalPresentation, - candidateSource: ComponentIdentifier) - extends UnsupportedOperationException( - s"Domain marshaller does not support decorator presentation ${TransportMarshaller - .getSimpleName(presentation.getClass)} for candidate ${TransportMarshaller.getSimpleName( - candidate.getClass)} from source $candidateSource") - -class UnsupportedModuleDomainMarshallerException( - presentation: Option[ModulePresentation], - candidateSource: ComponentIdentifier) - extends UnsupportedOperationException( - s"Domain marshaller does not support module presentation ${presentation - .map(p => - TransportMarshaller - .getSimpleName(presentation.getClass)).getOrElse("")} but was given a module from source $candidateSource") - -class UndecoratedModuleDomainMarshallerException( - candidateSource: ComponentIdentifier) - extends UnsupportedOperationException( - s"Domain marshaller does not support undecorated module from source $candidateSource") diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/BUILD deleted file mode 100644 index 994d481fd..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/BUILD +++ /dev/null @@ -1,23 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/feature", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/feature_hydrator", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline:query", - "stitch/stitch-core", - ], - exports = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/feature", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/feature_hydrator", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline:query", - "stitch/stitch-core", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/BUILD.docx new file mode 100644 index 000000000..b86af8f05 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/ScoredCandidateResult.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/ScoredCandidateResult.docx new file mode 100644 index 000000000..e64dd6d29 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/ScoredCandidateResult.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/ScoredCandidateResult.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/ScoredCandidateResult.scala deleted file mode 100644 index 7d856c50f..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/ScoredCandidateResult.scala +++ /dev/null @@ -1,13 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.scorer - -import com.twitter.product_mixer.core.feature.featuremap.FeatureMap -import com.twitter.product_mixer.core.model.common.CandidateWithFeatures -import com.twitter.product_mixer.core.model.common.UniversalNoun - -/** A [[Candidate]] and it's [[FeatureMap]] after being processed by a [[Scorer]] */ -case class ScoredCandidateResult[Candidate <: UniversalNoun[Any]]( - candidate: Candidate, - scorerResult: FeatureMap) - extends CandidateWithFeatures[Candidate] { - override val features: FeatureMap = scorerResult -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/Scorer.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/Scorer.docx new file mode 100644 index 000000000..ce4e73f42 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/Scorer.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/Scorer.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/Scorer.scala deleted file mode 100644 index e224cbc48..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer/Scorer.scala +++ /dev/null @@ -1,36 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.scorer - -import com.twitter.product_mixer.core.feature.Feature -import com.twitter.product_mixer.core.feature.featuremap.FeatureMap -import com.twitter.product_mixer.core.functional_component.feature_hydrator.BaseBulkCandidateFeatureHydrator -import com.twitter.product_mixer.core.model.common.CandidateWithFeatures -import com.twitter.product_mixer.core.model.common.SupportsConditionally -import com.twitter.product_mixer.core.model.common.UniversalNoun -import com.twitter.product_mixer.core.model.common.identifier.ScorerIdentifier -import com.twitter.product_mixer.core.pipeline.PipelineQuery -import com.twitter.stitch.Stitch - -/** Scores the provided `candidates` */ -trait Scorer[-Query <: PipelineQuery, -Candidate <: UniversalNoun[Any]] - extends BaseBulkCandidateFeatureHydrator[Query, Candidate, Feature[_, _]] - with SupportsConditionally[Query] { - - /** @see [[ScorerIdentifier]] */ - override val identifier: ScorerIdentifier - - /** - * Features returned by the Scorer - */ - def features: Set[Feature[_, _]] - - /** - * Scores the provided `candidates` - * - * @note the returned Seq of [[FeatureMap]] must contain all the input 'candidates' - * and be in the same order as the input 'candidates' - **/ - def apply( - query: Query, - candidates: Seq[CandidateWithFeatures[Candidate]] - ): Stitch[Seq[FeatureMap]] -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/BUILD deleted file mode 100644 index b1fadc1f7..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/BUILD +++ /dev/null @@ -1,19 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/common", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline", - ], - exports = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/common", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/BUILD.docx new file mode 100644 index 000000000..38fb7ef6a Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/Selector.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/Selector.docx new file mode 100644 index 000000000..f448436f3 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/Selector.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/Selector.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/Selector.scala deleted file mode 100644 index aaae604dd..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/Selector.scala +++ /dev/null @@ -1,24 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.selector - -import com.twitter.product_mixer.core.functional_component.common.CandidateScope -import com.twitter.product_mixer.core.model.common.presentation.CandidateWithDetails -import com.twitter.product_mixer.core.pipeline.PipelineQuery - -/** Selects some `remainingCandidates` and add them to the `result` */ -trait Selector[-Query <: PipelineQuery] { - - /** - * Specifies which [[com.twitter.product_mixer.core.model.common.presentation.CandidateWithDetails.source]]s - * this [[Selector]] will apply to. - * - * @note it is up to each [[Selector]] implementation to correctly handle this behavior - */ - def pipelineScope: CandidateScope - - /** Selects some `remainingCandidates` and add them to the `result` */ - def apply( - query: Query, - remainingCandidates: Seq[CandidateWithDetails], - result: Seq[CandidateWithDetails] - ): SelectorResult -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/SelectorResult.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/SelectorResult.docx new file mode 100644 index 000000000..4f2bc8d4f Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/SelectorResult.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/SelectorResult.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/SelectorResult.scala deleted file mode 100644 index e20a8cd6e..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/selector/SelectorResult.scala +++ /dev/null @@ -1,11 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.selector - -import com.twitter.product_mixer.core.model.common.presentation.CandidateWithDetails - -/** - * The result of a [[Selector]] where items that were added - * to the [[result]] are removed from the [[remainingCandidates]] - */ -case class SelectorResult( - remainingCandidates: Seq[CandidateWithDetails], - result: Seq[CandidateWithDetails]) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/BUILD deleted file mode 100644 index 95ff9136a..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/BUILD +++ /dev/null @@ -1,19 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline", - "stitch/stitch-core", - ], - exports = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline", - "stitch/stitch-core", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/BUILD.docx new file mode 100644 index 000000000..0d0a0a3d2 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/ExecuteSynchronously.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/ExecuteSynchronously.docx new file mode 100644 index 000000000..70d2a4d2c Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/ExecuteSynchronously.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/ExecuteSynchronously.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/ExecuteSynchronously.scala deleted file mode 100644 index 924aa89b6..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/ExecuteSynchronously.scala +++ /dev/null @@ -1,22 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.side_effect - -/** - * A modifier for any [[SideEffect]] so that the request waits for it to complete before being returned - * - * @note this will make the [[SideEffect]]'s latency impact the overall request's latency - * - * @example {{{ - * class MySideEffect extends PipelineResultSideEffect[T] with ExecuteSynchronously {...} - * }}} - * - * @example {{{ - * class MySideEffect extends ScribeLogEventSideEffect[T] with ExecuteSynchronously {...} - * }}} - */ -trait ExecuteSynchronously { _: SideEffect[_] => } - -/** - * A modifier for any [[ExecuteSynchronously]] [[SideEffect]] that makes it so failures will be - * reported in the results but wont cause the request as a whole to fail. - */ -trait FailOpen { _: ExecuteSynchronously => } diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/PipelineResultSideEffect.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/PipelineResultSideEffect.docx new file mode 100644 index 000000000..25a371de8 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/PipelineResultSideEffect.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/PipelineResultSideEffect.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/PipelineResultSideEffect.scala deleted file mode 100644 index d0e66a05f..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/PipelineResultSideEffect.scala +++ /dev/null @@ -1,60 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.side_effect - -import com.twitter.product_mixer.core.functional_component.side_effect.PipelineResultSideEffect.Inputs -import com.twitter.product_mixer.core.model.common -import com.twitter.product_mixer.core.model.common.presentation.CandidateWithDetails -import com.twitter.product_mixer.core.model.marshalling.HasMarshalling -import com.twitter.product_mixer.core.pipeline.PipelineQuery - -/** - * A side-effect that can be run with a pipeline result before transport marshalling - * - * @see SideEffect - * - * @tparam Query pipeline query - * @tparam ResultType response after domain marshalling - */ -trait PipelineResultSideEffect[-Query <: PipelineQuery, -ResultType <: HasMarshalling] - extends SideEffect[Inputs[Query, ResultType]] - with PipelineResultSideEffect.SupportsConditionally[Query, ResultType] - -object PipelineResultSideEffect { - - /** - * Mixin for when you want to conditionally run a [[PipelineResultSideEffect]] - * - * This is a thin wrapper around [[common.Conditionally]] exposing a nicer API for the [[PipelineResultSideEffect]] specific use-case. - */ - trait Conditionally[-Query <: PipelineQuery, -ResultType <: HasMarshalling] - extends common.Conditionally[Inputs[Query, ResultType]] { - _: PipelineResultSideEffect[Query, ResultType] => - - /** @see [[common.Conditionally.onlyIf]] */ - def onlyIf( - query: Query, - selectedCandidates: Seq[CandidateWithDetails], - remainingCandidates: Seq[CandidateWithDetails], - droppedCandidates: Seq[CandidateWithDetails], - response: ResultType - ): Boolean - - override final def onlyIf(input: Inputs[Query, ResultType]): Boolean = - onlyIf( - input.query, - input.selectedCandidates, - input.remainingCandidates, - input.droppedCandidates, - input.response) - - } - - type SupportsConditionally[-Query <: PipelineQuery, -ResultType <: HasMarshalling] = - common.SupportsConditionally[Inputs[Query, ResultType]] - - case class Inputs[+Query <: PipelineQuery, +ResultType <: HasMarshalling]( - query: Query, - selectedCandidates: Seq[CandidateWithDetails], - remainingCandidates: Seq[CandidateWithDetails], - droppedCandidates: Seq[CandidateWithDetails], - response: ResultType) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/SideEffect.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/SideEffect.docx new file mode 100644 index 000000000..46318877c Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/SideEffect.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/SideEffect.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/SideEffect.scala deleted file mode 100644 index b8a4d5a2b..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/side_effect/SideEffect.scala +++ /dev/null @@ -1,28 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.side_effect - -import com.twitter.product_mixer.core.model.common.Component -import com.twitter.product_mixer.core.model.common.identifier.SideEffectIdentifier -import com.twitter.stitch.Stitch - -/** - * A side-effect is a ancillary action that doesn't affect the result of execution directly. - * - * For example: Logging, history stores - * - * Implementing components can express failures by throwing an exception. These exceptions - * will be caught and not affect the request processing. - * - * @note Side effects execute asynchronously in a fire-and-forget way, it's important to add alerts - * to the [[SideEffect]] component itself since a failures wont show up in metrics - * that just monitor your pipeline as a whole. - * - * @see [[ExecuteSynchronously]] for modifying a [[SideEffect]] to execute with synchronously with - * the request waiting on the side effect to complete, this will impact the overall request's latency - **/ -trait SideEffect[-Inputs] extends Component { - - /** @see [[SideEffectIdentifier]] */ - override val identifier: SideEffectIdentifier - - def apply(inputs: Inputs): Stitch[Unit] -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/BUILD deleted file mode 100644 index 52cd7bd26..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/BUILD +++ /dev/null @@ -1,23 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/feature", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/pipeline_failure", - ], - exports = [ - "3rdparty/jvm/javax/inject:javax.inject", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/feature", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/pipeline_failure", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/BUILD.docx new file mode 100644 index 000000000..5f2c4efa1 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidateFeatureTransformer.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidateFeatureTransformer.docx new file mode 100644 index 000000000..34da2d1ed Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidateFeatureTransformer.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidateFeatureTransformer.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidateFeatureTransformer.scala deleted file mode 100644 index 454970f78..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidateFeatureTransformer.scala +++ /dev/null @@ -1,8 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.transformer - -/** - * Populates a [[com.twitter.product_mixer.core.feature.featuremap.FeatureMap]] with Features - * that are available in the [[CandidateSourceResult]] - */ -trait CandidateFeatureTransformer[-CandidateSourceResult] - extends FeatureTransformer[CandidateSourceResult] diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidatePipelineQueryTransformer.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidatePipelineQueryTransformer.docx new file mode 100644 index 000000000..867c6f789 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidatePipelineQueryTransformer.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidatePipelineQueryTransformer.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidatePipelineQueryTransformer.scala deleted file mode 100644 index 58c4a8735..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidatePipelineQueryTransformer.scala +++ /dev/null @@ -1,85 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.transformer - -import com.twitter.product_mixer.core.model.common.identifier.ComponentIdentifier -import com.twitter.product_mixer.core.model.common.identifier.TransformerIdentifier -import com.twitter.product_mixer.core.model.common.presentation.CandidateWithDetails -import com.twitter.product_mixer.core.pipeline.PipelineQuery -import com.twitter.product_mixer.core.pipeline.CandidatePipelineResults -import com.twitter.product_mixer.core.pipeline.pipeline_failure.IllegalStateFailure -import com.twitter.product_mixer.core.pipeline.pipeline_failure.PipelineFailure - -/** - * A transformer for transforming a mixer or recommendation pipeline's query type into a candidate - * pipeline's query type. - * @tparam Query The parent pipeline's query type - * @tparam CandidateSourceQuery The Candidate Source's query type that the Query should be converted to - */ -protected[core] sealed trait BaseCandidatePipelineQueryTransformer[ - -Query <: PipelineQuery, - +CandidateSourceQuery] - extends Transformer[Query, CandidateSourceQuery] { - - override val identifier: TransformerIdentifier = - BaseCandidatePipelineQueryTransformer.DefaultTransformerId -} - -trait CandidatePipelineQueryTransformer[-Query <: PipelineQuery, CandidateSourceQuery] - extends BaseCandidatePipelineQueryTransformer[Query, CandidateSourceQuery] - -trait DependentCandidatePipelineQueryTransformer[-Query <: PipelineQuery, CandidateSourceQuery] - extends BaseCandidatePipelineQueryTransformer[Query, CandidateSourceQuery] { - def transform(query: Query, candidates: Seq[CandidateWithDetails]): CandidateSourceQuery - - final override def transform(query: Query): CandidateSourceQuery = { - val candidates = query.features - .map(_.get(CandidatePipelineResults)).getOrElse( - throw PipelineFailure( - IllegalStateFailure, - "Candidate Pipeline Results Feature missing from query features")) - transform(query, candidates) - } -} - -object BaseCandidatePipelineQueryTransformer { - private[core] val DefaultTransformerId: TransformerIdentifier = - TransformerIdentifier(ComponentIdentifier.BasedOnParentComponent) - private[core] val TransformerIdSuffix = "Query" - - /** - * For use when building a [[BaseCandidatePipelineQueryTransformer]] in a [[com.twitter.product_mixer.core.pipeline.PipelineBuilder]] - * to ensure that the identifier is updated with the parent [[com.twitter.product_mixer.core.pipeline.Pipeline.identifier]] - */ - private[core] def copyWithUpdatedIdentifier[Query <: PipelineQuery, CandidateSourceQuery]( - queryTransformer: BaseCandidatePipelineQueryTransformer[Query, CandidateSourceQuery], - parentIdentifier: ComponentIdentifier - ): BaseCandidatePipelineQueryTransformer[Query, CandidateSourceQuery] = { - if (queryTransformer.identifier == DefaultTransformerId) { - val transformerIdentifierFromParentName = TransformerIdentifier( - s"${parentIdentifier.name}$TransformerIdSuffix") - queryTransformer match { - case queryTransformer: CandidatePipelineQueryTransformer[Query, CandidateSourceQuery] => - new CandidatePipelineQueryTransformer[Query, CandidateSourceQuery] { - override val identifier: TransformerIdentifier = transformerIdentifierFromParentName - - override def transform(input: Query): CandidateSourceQuery = - queryTransformer.transform(input) - } - case queryTransformer: DependentCandidatePipelineQueryTransformer[ - Query, - CandidateSourceQuery - ] => - new DependentCandidatePipelineQueryTransformer[Query, CandidateSourceQuery] { - override val identifier: TransformerIdentifier = transformerIdentifierFromParentName - - override def transform( - input: Query, - candidates: Seq[CandidateWithDetails] - ): CandidateSourceQuery = - queryTransformer.transform(input, candidates) - } - } - } else { - queryTransformer - } - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidatePipelineResultsTransformer.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidatePipelineResultsTransformer.docx new file mode 100644 index 000000000..123fa454c Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidatePipelineResultsTransformer.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidatePipelineResultsTransformer.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidatePipelineResultsTransformer.scala deleted file mode 100644 index 80c29d7fb..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/CandidatePipelineResultsTransformer.scala +++ /dev/null @@ -1,45 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.transformer - -import com.twitter.product_mixer.core.model.common.UniversalNoun -import com.twitter.product_mixer.core.model.common.identifier.ComponentIdentifier -import com.twitter.product_mixer.core.model.common.identifier.TransformerIdentifier - -/** - * A transformer for transforming a candidate pipeline's source result type into the parent's - * mixer ore recommendation pipeline's type. - * @tparam SourceResult The type of the result of the candidate source being used. - * @tparam PipelineResult The type of the parent pipeline's expected - */ -trait CandidatePipelineResultsTransformer[SourceResult, PipelineResult <: UniversalNoun[Any]] - extends Transformer[SourceResult, PipelineResult] { - - override val identifier: TransformerIdentifier = - CandidatePipelineResultsTransformer.DefaultTransformerId -} - -object CandidatePipelineResultsTransformer { - private[core] val DefaultTransformerId: TransformerIdentifier = - TransformerIdentifier(ComponentIdentifier.BasedOnParentComponent) - private[core] val TransformerIdSuffix = "Results" - - /** - * For use when building a [[CandidatePipelineResultsTransformer]] in a [[com.twitter.product_mixer.core.pipeline.PipelineBuilder]] - * to ensure that the identifier is updated with the parent [[com.twitter.product_mixer.core.pipeline.Pipeline.identifier]] - */ - private[core] def copyWithUpdatedIdentifier[SourceResult, PipelineResult <: UniversalNoun[Any]]( - resultTransformer: CandidatePipelineResultsTransformer[SourceResult, PipelineResult], - parentIdentifier: ComponentIdentifier - ): CandidatePipelineResultsTransformer[SourceResult, PipelineResult] = { - if (resultTransformer.identifier == DefaultTransformerId) { - new CandidatePipelineResultsTransformer[SourceResult, PipelineResult] { - override val identifier: TransformerIdentifier = TransformerIdentifier( - s"${parentIdentifier.name}$TransformerIdSuffix") - - override def transform(input: SourceResult): PipelineResult = - resultTransformer.transform(input) - } - } else { - resultTransformer - } - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/FeatureTransformer.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/FeatureTransformer.docx new file mode 100644 index 000000000..5da0110d0 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/FeatureTransformer.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/FeatureTransformer.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/FeatureTransformer.scala deleted file mode 100644 index 82d22d1d5..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/FeatureTransformer.scala +++ /dev/null @@ -1,27 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.transformer - -import com.twitter.product_mixer.core.feature.Feature -import com.twitter.product_mixer.core.feature.featuremap.FeatureMap -import com.twitter.product_mixer.core.model.common.identifier.TransformerIdentifier - -/** - * [[FeatureTransformer]] allow you to populate a [[com.twitter.product_mixer.core.feature.Feature]]s - * value which is already available or can be derived without making an RPC. - * - * A [[FeatureTransformer]] transforms a given [[Inputs]] into a [[FeatureMap]]. - * The transformer must specify which [[com.twitter.product_mixer.core.feature.Feature]]s it will populate using the `features` field - * and the returned [[FeatureMap]] must always have the specified [[com.twitter.product_mixer.core.feature.Feature]]s populated. - * - * @note Unlike [[com.twitter.product_mixer.core.functional_component.feature_hydrator.FeatureHydrator]] implementations, - * an exception thrown in a [[FeatureTransformer]] will not be added to the [[FeatureMap]] and will instead be - * bubble up to the calling pipeline's [[com.twitter.product_mixer.core.pipeline.pipeline_failure.PipelineFailureClassifier]]. - */ -trait FeatureTransformer[-Inputs] extends Transformer[Inputs, FeatureMap] { - - def features: Set[Feature[_, _]] - - override val identifier: TransformerIdentifier - - /** Hydrates a [[FeatureMap]] for a given [[Inputs]] */ - override def transform(input: Inputs): FeatureMap -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/Transformer.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/Transformer.docx new file mode 100644 index 000000000..bbcfbcbab Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/Transformer.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/Transformer.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/Transformer.scala deleted file mode 100644 index 8dfe0b2c4..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/transformer/Transformer.scala +++ /dev/null @@ -1,15 +0,0 @@ -package com.twitter.product_mixer.core.functional_component.transformer - -import com.twitter.product_mixer.core.model.common.Component -import com.twitter.product_mixer.core.model.common.identifier.TransformerIdentifier - -/** - * A transformer is a synchronous transformation that takes the provided [[Input]] and returns some - * defined [[Output]]. For example, extracting a score from from a scored candidates. - */ -trait Transformer[-Inputs, +Output] extends Component { - override val identifier: TransformerIdentifier - - /** Takes [[Inputs]] and transformers them into some [[Output]] of your choosing. */ - def transform(input: Inputs): Output -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/BUILD deleted file mode 100644 index fb0bf8981..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/BUILD +++ /dev/null @@ -1,15 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/gate", - "stitch/stitch-core", - ], - exports = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/gate", - "stitch/stitch-core", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/BUILD.docx new file mode 100644 index 000000000..28ab89dcc Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/DenyLoggedOutUsersGate.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/DenyLoggedOutUsersGate.docx new file mode 100644 index 000000000..8a3072341 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/DenyLoggedOutUsersGate.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/DenyLoggedOutUsersGate.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/DenyLoggedOutUsersGate.scala deleted file mode 100644 index a4bfd9e8e..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/DenyLoggedOutUsersGate.scala +++ /dev/null @@ -1,31 +0,0 @@ -package com.twitter.product_mixer.core.gate - -import com.twitter.product_mixer.core.functional_component.gate.Gate -import com.twitter.product_mixer.core.gate.DenyLoggedOutUsersGate.Suffix -import com.twitter.product_mixer.core.model.common.identifier.ComponentIdentifier -import com.twitter.product_mixer.core.model.common.identifier.GateIdentifier -import com.twitter.product_mixer.core.pipeline.PipelineQuery -import com.twitter.product_mixer.core.pipeline.pipeline_failure.Authentication -import com.twitter.product_mixer.core.pipeline.pipeline_failure.PipelineFailure -import com.twitter.stitch.Stitch - -case class DenyLoggedOutUsersGate(pipelineIdentifier: ComponentIdentifier) - extends Gate[PipelineQuery] { - override val identifier: GateIdentifier = GateIdentifier(pipelineIdentifier + Suffix) - - override def shouldContinue(query: PipelineQuery): Stitch[Boolean] = { - if (query.getUserOrGuestId.nonEmpty) { - Stitch.value(!query.isLoggedOut) - } else { - Stitch.exception( - PipelineFailure( - Authentication, - "Expected either a `userId` (for logged in users) or `guestId` (for logged out users) but found neither" - )) - } - } -} - -object DenyLoggedOutUsersGate { - val Suffix = "DenyLoggedOutUsers" -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/ParamGate.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/ParamGate.docx new file mode 100644 index 000000000..5fa2a4cd8 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/ParamGate.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/ParamGate.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/ParamGate.scala deleted file mode 100644 index bc58ed797..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/ParamGate.scala +++ /dev/null @@ -1,22 +0,0 @@ -package com.twitter.product_mixer.core.gate - -import com.twitter.product_mixer.core.functional_component.gate.Gate -import com.twitter.product_mixer.core.model.common.identifier.GateIdentifier -import com.twitter.product_mixer.core.pipeline.PipelineQuery -import com.twitter.stitch.Stitch -import com.twitter.timelines.configapi.Param - -case class ParamGate(name: String, param: Param[Boolean])(implicit file: sourcecode.File) - extends Gate[PipelineQuery] { - - // From a customer-perspective, it's more useful to see the file that created the ParamGate - override val identifier: GateIdentifier = GateIdentifier(name)(file) - - override def shouldContinue(query: PipelineQuery): Stitch[Boolean] = - Stitch.value(query.params(param)) -} - -object ParamGate { - val EnabledGateSuffix = "Enabled" - val SupportedClientGateSuffix = "SupportedClient" -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/ParamNotGate.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/ParamNotGate.docx new file mode 100644 index 000000000..c9576d3a8 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/ParamNotGate.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/ParamNotGate.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/ParamNotGate.scala deleted file mode 100644 index 38d735a15..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/gate/ParamNotGate.scala +++ /dev/null @@ -1,14 +0,0 @@ -package com.twitter.product_mixer.core.gate - -import com.twitter.product_mixer.core.functional_component.gate.Gate -import com.twitter.product_mixer.core.model.common.identifier.GateIdentifier -import com.twitter.product_mixer.core.pipeline.PipelineQuery -import com.twitter.stitch.Stitch -import com.twitter.timelines.configapi.Param - -case class ParamNotGate(name: String, param: Param[Boolean]) extends Gate[PipelineQuery] { - override val identifier: GateIdentifier = GateIdentifier(name) - - override def shouldContinue(query: PipelineQuery): Stitch[Boolean] = - Stitch.value(!query.params(param)) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/BUILD deleted file mode 100644 index e84333ff3..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/BUILD +++ /dev/null @@ -1,25 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/com/fasterxml/jackson/core:jackson-annotations", - "3rdparty/jvm/com/fasterxml/jackson/core:jackson-core", - "3rdparty/jvm/com/fasterxml/jackson/core:jackson-databind", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/feature", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/feature/featuremap", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/common/alert", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier", - ], - exports = [ - "3rdparty/jvm/com/fasterxml/jackson/core:jackson-annotations", - "3rdparty/jvm/com/fasterxml/jackson/core:jackson-core", - "3rdparty/jvm/com/fasterxml/jackson/core:jackson-databind", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/feature", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/feature/featuremap", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/common/alert", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/BUILD.docx new file mode 100644 index 000000000..187f172a8 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/CandidateWithFeatures.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/CandidateWithFeatures.docx new file mode 100644 index 000000000..52755c0fc Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/CandidateWithFeatures.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/CandidateWithFeatures.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/CandidateWithFeatures.scala deleted file mode 100644 index b8c7a8e47..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/CandidateWithFeatures.scala +++ /dev/null @@ -1,18 +0,0 @@ -package com.twitter.product_mixer.core.model.common - -import com.twitter.product_mixer.core.feature.featuremap.FeatureMap - -/** [[Candidate]] and it's FeatureMap */ -trait CandidateWithFeatures[+Candidate <: UniversalNoun[Any]] { - val candidate: Candidate - val features: FeatureMap -} - -object CandidateWithFeatures { - def unapply[Candidate <: UniversalNoun[Any]]( - candidateWithFeatures: CandidateWithFeatures[Candidate] - ): Option[(Candidate, FeatureMap)] = - Some( - (candidateWithFeatures.candidate, candidateWithFeatures.features) - ) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/Component.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/Component.docx new file mode 100644 index 000000000..7b9ab6b25 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/Component.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/Component.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/Component.scala deleted file mode 100644 index 2edeb220c..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/Component.scala +++ /dev/null @@ -1,18 +0,0 @@ -package com.twitter.product_mixer.core.model.common - -import com.twitter.product_mixer.core.functional_component.common.alert.Alert -import com.twitter.product_mixer.core.model.common.identifier.ComponentIdentifier -import com.twitter.product_mixer.core.model.common.identifier.HasComponentIdentifier - -/** - * Components are very generically reusable composable pieces - * Components are uniquely identifiable and centrally registered - */ -trait Component extends HasComponentIdentifier { - - /** @see [[ComponentIdentifier]] */ - override val identifier: ComponentIdentifier - - /** the [[Alert]]s that will be used for this component. */ - val alerts: Seq[Alert] = Seq.empty -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/Conditionally.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/Conditionally.docx new file mode 100644 index 000000000..02ec1e36e Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/Conditionally.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/Conditionally.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/Conditionally.scala deleted file mode 100644 index 3b6362849..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/Conditionally.scala +++ /dev/null @@ -1,57 +0,0 @@ -package com.twitter.product_mixer.core.model.common - -/** - * A mixin trait that can be added to a [[Component]] that's marked with [[SupportsConditionally]] - * A [[Component]] with [[SupportsConditionally]] and [[Conditionally]] will only be run when `onlyIf` returns true - * if `onlyIf` returns false, the [[Component]] is skipped and no stats are recorded for it. - * - * @note if an exception is thrown when evaluating `onlyIf`, it will bubble up to the containing `Pipeline`, - * however the [[Component]]'s stats will not be incremented. Because of this `onlyIf` should never throw. - * - * @note each [[Component]] that [[SupportsConditionally]] has an implementation with in the - * component library that will conditionally run the component based on a [[com.twitter.timelines.configapi.Param]] - * - * @note [[Conditionally]] functionality is wired into the Component's Executor. - * - * @tparam Input the input that is used to gate a component on or off - */ -trait Conditionally[-Input] { _: SupportsConditionally[Input] => - - /** - * if `onlyIf` returns true, the underling [[Component]] is run, otherwise it's skipped - * @note must not throw - */ - def onlyIf(query: Input): Boolean -} - -/** - * Marker trait added to the base type for each [[Component]] which supports the [[Conditionally]] mixin - * - * @note this is `private[core]` because it can only be added to the base implementation of components by the Product Mixer team - * - * @tparam Input the input that is used to gate a component on or off if [[Conditionally]] is mixed in - */ -private[core] trait SupportsConditionally[-Input] { _: Component => } - -object Conditionally { - - /** - * Helper method for combining the [[Conditionally.onlyIf]] of an underlying [[Component]] with an additional predicate - */ - def and[ComponentType <: Component, Input]( - query: Input, - component: ComponentType with SupportsConditionally[Input], - onlyIf: Boolean - ): Boolean = - onlyIf && { - component match { - // @unchecked is safe here because the type parameter is guaranteed by - // the `SupportsConditionally[Input]` type parameter - case underlying: Conditionally[Input @unchecked] => - underlying.onlyIf(query) - case _ => - true - } - } - -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/UniversalNoun.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/UniversalNoun.docx new file mode 100644 index 000000000..5cc3a1b15 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/UniversalNoun.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/UniversalNoun.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/UniversalNoun.scala deleted file mode 100644 index 68acda414..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/UniversalNoun.scala +++ /dev/null @@ -1,8 +0,0 @@ -package com.twitter.product_mixer.core.model.common - -import com.fasterxml.jackson.annotation.JsonTypeInfo - -@JsonTypeInfo(include = JsonTypeInfo.As.PROPERTY, use = JsonTypeInfo.Id.NAME) -trait UniversalNoun[+T] extends Equals { - def id: T -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/BUILD deleted file mode 100644 index 16504ded3..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/BUILD +++ /dev/null @@ -1,15 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/com/lihaoyi:sourcecode", - "util/util-core", - "util/util-jackson/src/main/scala/com/twitter/util/jackson", - ], - exports = [ - "3rdparty/jvm/com/lihaoyi:sourcecode", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/BUILD.docx new file mode 100644 index 000000000..7c9775fd8 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/CandidatePipelineIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/CandidatePipelineIdentifier.docx new file mode 100644 index 000000000..8dc1261f8 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/CandidatePipelineIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/CandidatePipelineIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/CandidatePipelineIdentifier.scala deleted file mode 100644 index 1ad6ec144..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/CandidatePipelineIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Candidate Pipeline identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class CandidatePipelineIdentifier(override val name: String) - extends ComponentIdentifier("CandidatePipeline", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[CandidatePipelineIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: CandidatePipelineIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object CandidatePipelineIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): CandidatePipelineIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new CandidatePipelineIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal CandidatePipelineIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/CandidateSourceIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/CandidateSourceIdentifier.docx new file mode 100644 index 000000000..192d8c11d Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/CandidateSourceIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/CandidateSourceIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/CandidateSourceIdentifier.scala deleted file mode 100644 index b83cb011d..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/CandidateSourceIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Candidate Source identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class CandidateSourceIdentifier(override val name: String) - extends ComponentIdentifier("CandidateSource", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[CandidateSourceIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: CandidateSourceIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object CandidateSourceIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): CandidateSourceIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new CandidateSourceIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal CandidateSourceIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifier.docx new file mode 100644 index 000000000..7597c6132 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifier.scala deleted file mode 100644 index a95973ea2..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifier.scala +++ /dev/null @@ -1,111 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.twitter.conversions.StringOps -import scala.util.matching.Regex - -/** - * Component Identifiers are a type of identifier used in product mixer to identify - * unique components - products, pipelines, candidate sources. - * - * Each identifier has two parts - a type and a name. Subclasses of [[ComponentIdentifier]] - * should hardcode the `componentType`, and be declared in this file. - * - * For example, a [[ProductPipelineIdentifier]] has the type "ProductPipeline". - * - * Component identifiers are used in: - * - Logs - * - Tooling - * - Metrics - * - Feature Switches - * - * A component identifier name is restricted to: - * - 3 to 80 characters to ensure reasonable length - * - A-Z, a-z, and Digits - * - Must start with A-Z - * - Digits only on the ends of "words" - * - Examples include "AlphaSample" and "UsersLikeMe" - * - and "SimsV2" or "Test6" - * - * Avoid including types like "Pipeline", "MixerPipeline" etc in your identifier. these - * can be implied by the type itself, and will automatically be used where appropriate (logs etc). - */ -@JsonSerialize(using = classOf[ComponentIdentifierSerializer]) -abstract class ComponentIdentifier( - val componentType: String, - val name: String) - extends Equals { - - val file: sourcecode.File = "" - - override val toString: String = s"$name$componentType" - - val snakeCase: String = StringOps.toSnakeCase(toString) - - val toScopes: Seq[String] = Seq(componentType, name) -} - -object ComponentIdentifier { - // Allows for CamelCase and CamelCaseVer3 styles - val AllowedCharacters: Regex = "([A-Z][A-Za-z]*[0-9]*)+".r - val MinLength = 3 - val MaxLength = 80 - - /** - * When a [[ComponentIdentifier.name]] is [[BasedOnParentComponent]] - * then when operations that depend on the [[ComponentIdentifier]] - * are performed, like registering and stats, we will perform that - * operation by substituting the [[ComponentIdentifier.name]] with - * the parent component's [[ComponentIdentifier.name]]. - */ - private[core] val BasedOnParentComponent = "BasedOnParentComponent" - - def isValidName(name: String): Boolean = { - name match { - case n if n.length < MinLength => - false - case n if n.length > MaxLength => - false - case AllowedCharacters(_*) => - true - case _ => - false - } - } - - implicit val ordering: Ordering[ComponentIdentifier] = - Ordering.by { component => - val componentTypeRank = component match { - case _: ProductIdentifier => 0 - case _: ProductPipelineIdentifier => 1 - case _: MixerPipelineIdentifier => 2 - case _: RecommendationPipelineIdentifier => 3 - case _: ScoringPipelineIdentifier => 4 - case _: CandidatePipelineIdentifier => 5 - case _: PipelineStepIdentifier => 6 - case _: CandidateSourceIdentifier => 7 - case _: FeatureHydratorIdentifier => 8 - case _: GateIdentifier => 9 - case _: FilterIdentifier => 10 - case _: TransformerIdentifier => 11 - case _: ScorerIdentifier => 12 - case _: DecoratorIdentifier => 13 - case _: DomainMarshallerIdentifier => 14 - case _: TransportMarshallerIdentifier => 15 - case _: SideEffectIdentifier => 16 - case _: PlatformIdentifier => 17 - case _: SelectorIdentifier => 18 - case _ => Int.MaxValue - } - - // First rank by type, then by name for equivalent types for overall order stability - (componentTypeRank, component.name) - } -} - -/** - * HasComponentIdentifier indicates that component has a [[ComponentIdentifier]] - */ -trait HasComponentIdentifier { - val identifier: ComponentIdentifier -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierSerializer.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierSerializer.docx new file mode 100644 index 000000000..781b0f629 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierSerializer.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierSerializer.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierSerializer.scala deleted file mode 100644 index a9c2cac6a..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierSerializer.scala +++ /dev/null @@ -1,21 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.databind.JsonSerializer -import com.fasterxml.jackson.databind.SerializerProvider - -private[identifier] class ComponentIdentifierSerializer() - extends JsonSerializer[ComponentIdentifier] { - - private case class SerializableComponentIdentifier( - identifier: String, - sourceFile: String) - - override def serialize( - componentIdentifier: ComponentIdentifier, - gen: JsonGenerator, - serializers: SerializerProvider - ): Unit = serializers.defaultSerializeValue( - SerializableComponentIdentifier(componentIdentifier.toString, componentIdentifier.file.value), - gen) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierStack.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierStack.docx new file mode 100644 index 000000000..536927ffc Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierStack.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierStack.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierStack.scala deleted file mode 100644 index 663e3a3dd..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierStack.scala +++ /dev/null @@ -1,64 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -import com.fasterxml.jackson.databind.annotation.JsonSerialize - -/** - * A non-empty immutable stack of [[ComponentIdentifier]]s - * - * [[ComponentIdentifierStack]] does not support removing [[ComponentIdentifier]]s, - * instead a [[ComponentIdentifierStack]] should be used by adding new [[ComponentIdentifier]]s - * as processing enters a given `Component`, then discarded after. - * Think of this as similar to a let-scoped variable, where the let-scope is the given component. - */ -@JsonSerialize(using = classOf[ComponentIdentifierStackSerializer]) -class ComponentIdentifierStack private (val componentIdentifiers: List[ComponentIdentifier]) { - - /** Make a new [[ComponentIdentifierStack]] with the [[ComponentIdentifier]] added at the top */ - def push(newComponentIdentifier: ComponentIdentifier): ComponentIdentifierStack = - new ComponentIdentifierStack(newComponentIdentifier :: componentIdentifiers) - - /** Make a new [[ComponentIdentifierStack]] with the [[ComponentIdentifier]]s added at the top */ - def push(newComponentIdentifiers: ComponentIdentifierStack): ComponentIdentifierStack = - new ComponentIdentifierStack( - newComponentIdentifiers.componentIdentifiers ::: componentIdentifiers) - - /** Make a new [[ComponentIdentifierStack]] with the [[ComponentIdentifier]]s added at the top */ - def push(newComponentIdentifiers: Option[ComponentIdentifierStack]): ComponentIdentifierStack = { - newComponentIdentifiers match { - case Some(newComponentIdentifiers) => push(newComponentIdentifiers) - case None => this - } - } - - /** Return the top element of the [[ComponentIdentifierStack]] */ - val peek: ComponentIdentifier = componentIdentifiers.head - - /** Return the size of the [[ComponentIdentifierStack]] */ - def size: Int = componentIdentifiers.length - - override def toString: String = - s"ComponentIdentifierStack(componentIdentifiers = $componentIdentifiers)" - - override def equals(obj: Any): Boolean = { - obj match { - case componentIdentifierStack: ComponentIdentifierStack - if componentIdentifierStack.eq(this) || - componentIdentifierStack.componentIdentifiers == componentIdentifiers => - true - case _ => false - } - } -} - -object ComponentIdentifierStack { - - /** - * Returns a [[ComponentIdentifierStack]] from the given [[ComponentIdentifier]]s, - * where the top of the stack is the left-most [[ComponentIdentifier]] - */ - def apply( - componentIdentifier: ComponentIdentifier, - componentIdentifierStack: ComponentIdentifier* - ) = - new ComponentIdentifierStack(componentIdentifier :: componentIdentifierStack.toList) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierStackSerializer.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierStackSerializer.docx new file mode 100644 index 000000000..cb157d5f9 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierStackSerializer.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierStackSerializer.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierStackSerializer.scala deleted file mode 100644 index da8855df1..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ComponentIdentifierStackSerializer.scala +++ /dev/null @@ -1,14 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.databind.JsonSerializer -import com.fasterxml.jackson.databind.SerializerProvider - -private[identifier] class ComponentIdentifierStackSerializer() - extends JsonSerializer[ComponentIdentifierStack] { - override def serialize( - componentIdentifierStack: ComponentIdentifierStack, - gen: JsonGenerator, - serializers: SerializerProvider - ): Unit = serializers.defaultSerializeValue(componentIdentifierStack.componentIdentifiers, gen) -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/DecoratorIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/DecoratorIdentifier.docx new file mode 100644 index 000000000..de3961055 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/DecoratorIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/DecoratorIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/DecoratorIdentifier.scala deleted file mode 100644 index 3a9cfef88..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/DecoratorIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Decorator identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class DecoratorIdentifier(override val name: String) - extends ComponentIdentifier("Decorator", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[DecoratorIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: DecoratorIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object DecoratorIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): DecoratorIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new DecoratorIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal DecoratorIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/DomainMarshallerIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/DomainMarshallerIdentifier.docx new file mode 100644 index 000000000..85bb72f98 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/DomainMarshallerIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/DomainMarshallerIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/DomainMarshallerIdentifier.scala deleted file mode 100644 index b0b22bb16..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/DomainMarshallerIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Domain Marshaller identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class DomainMarshallerIdentifier(override val name: String) - extends ComponentIdentifier("DomainMarshaller", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[DomainMarshallerIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: DomainMarshallerIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object DomainMarshallerIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): DomainMarshallerIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new DomainMarshallerIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal DomainMarshallerIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/FeatureHydratorIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/FeatureHydratorIdentifier.docx new file mode 100644 index 000000000..d2cd5a18a Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/FeatureHydratorIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/FeatureHydratorIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/FeatureHydratorIdentifier.scala deleted file mode 100644 index 46ace3cbd..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/FeatureHydratorIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Feature Hydrator identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class FeatureHydratorIdentifier(override val name: String) - extends ComponentIdentifier("FeatureHydrator", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[FeatureHydratorIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: FeatureHydratorIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object FeatureHydratorIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): FeatureHydratorIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new FeatureHydratorIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal FeatureHydratorIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/FilterIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/FilterIdentifier.docx new file mode 100644 index 000000000..b4c5636d6 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/FilterIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/FilterIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/FilterIdentifier.scala deleted file mode 100644 index 2b5c2113e..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/FilterIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Filter identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class FilterIdentifier(override val name: String) - extends ComponentIdentifier("Filter", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[FilterIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: FilterIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object FilterIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): FilterIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new FilterIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal FilterIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/GateIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/GateIdentifier.docx new file mode 100644 index 000000000..10b710522 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/GateIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/GateIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/GateIdentifier.scala deleted file mode 100644 index 19309aa21..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/GateIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Gate identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class GateIdentifier(override val name: String) - extends ComponentIdentifier("Gate", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[GateIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: GateIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object GateIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): GateIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new GateIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal GateIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/MixerPipelineIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/MixerPipelineIdentifier.docx new file mode 100644 index 000000000..2b1b9e447 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/MixerPipelineIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/MixerPipelineIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/MixerPipelineIdentifier.scala deleted file mode 100644 index 696dc4ff1..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/MixerPipelineIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Mixer Pipeline identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class MixerPipelineIdentifier(override val name: String) - extends ComponentIdentifier("MixerPipeline", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[MixerPipelineIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: MixerPipelineIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object MixerPipelineIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): MixerPipelineIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new MixerPipelineIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal MixerPipelineIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/PipelineStepIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/PipelineStepIdentifier.docx new file mode 100644 index 000000000..930f4efd4 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/PipelineStepIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/PipelineStepIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/PipelineStepIdentifier.scala deleted file mode 100644 index 5df48e069..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/PipelineStepIdentifier.scala +++ /dev/null @@ -1,90 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Pipeline Step identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class PipelineStepIdentifier( - override val name: String) - extends ComponentIdentifier("Step", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[PipelineStepIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: PipelineStepIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -class Person(val name: String, val age: Int) extends Equals { - override def canEqual(that: Any): Boolean = - that.isInstanceOf[Person] - - //Intentionally avoiding the call to super.equals because no ancestor has overridden equals (see note 7 below) - override def equals(that: Any): Boolean = - that match { - case person: Person => - (this eq person) || (hashCode == person.hashCode) && ((name == person.name) && (age == person.age)) - - case _ => - false - } - - //Intentionally avoiding the call to super.hashCode because no ancestor has overridden hashCode (see note 7 below) - override def hashCode(): Int = - 31 * ( - name.## - ) + age.## -} - -object PipelineStepIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): PipelineStepIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new PipelineStepIdentifier(name) { override val file: sourcecode.File = sourceFile } - else - throw new IllegalArgumentException(s"Illegal StepIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/PlatformIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/PlatformIdentifier.docx new file mode 100644 index 000000000..6229b81ee Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/PlatformIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/PlatformIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/PlatformIdentifier.scala deleted file mode 100644 index 47a0c57e2..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/PlatformIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * [[ComponentIdentifier]] type used by internal parts of Product Mixer that need to be identified - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class PlatformIdentifier(override val name: String) - extends ComponentIdentifier("Platform", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[PlatformIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: PlatformIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object PlatformIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): PlatformIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new PlatformIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal PlatformIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ProductIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ProductIdentifier.docx new file mode 100644 index 000000000..578f62fc8 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ProductIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ProductIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ProductIdentifier.scala deleted file mode 100644 index 681be8c9d..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ProductIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Product identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class ProductIdentifier(override val name: String) - extends ComponentIdentifier("Product", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[ProductIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: ProductIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object ProductIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): ProductIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new ProductIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal ProductIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ProductPipelineIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ProductPipelineIdentifier.docx new file mode 100644 index 000000000..e7afddae7 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ProductPipelineIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ProductPipelineIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ProductPipelineIdentifier.scala deleted file mode 100644 index 21a8ca26d..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ProductPipelineIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Product Pipeline identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class ProductPipelineIdentifier(override val name: String) - extends ComponentIdentifier("ProductPipeline", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[ProductPipelineIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: ProductPipelineIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object ProductPipelineIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): ProductPipelineIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new ProductPipelineIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal ProductPipelineIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/RecommendationPipelineIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/RecommendationPipelineIdentifier.docx new file mode 100644 index 000000000..84f485138 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/RecommendationPipelineIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/RecommendationPipelineIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/RecommendationPipelineIdentifier.scala deleted file mode 100644 index f10e6d28d..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/RecommendationPipelineIdentifier.scala +++ /dev/null @@ -1,74 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Recommendation Pipeline identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class RecommendationPipelineIdentifier(override val name: String) - extends ComponentIdentifier("RecommendationPipeline", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[RecommendationPipelineIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: RecommendationPipelineIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object RecommendationPipelineIdentifier { - def apply( - name: String - )( - implicit sourceFile: sourcecode.File - ): RecommendationPipelineIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new RecommendationPipelineIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal RecommendationPipelineIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/RootIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/RootIdentifier.docx new file mode 100644 index 000000000..0dabccd89 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/RootIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/RootIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/RootIdentifier.scala deleted file mode 100644 index 5d55c6422..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/RootIdentifier.scala +++ /dev/null @@ -1,66 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Root identifier used as the root identifier for products during component registration - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class RootIdentifier extends ComponentIdentifier("Root", "") { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[RootIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: RootIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object RootIdentifier { - def apply()(implicit sourceFile: sourcecode.File): RootIdentifier = { - new RootIdentifier() { - override val file: sourcecode.File = sourceFile - } - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ScorerIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ScorerIdentifier.docx new file mode 100644 index 000000000..365851f62 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ScorerIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ScorerIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ScorerIdentifier.scala deleted file mode 100644 index 3caee298f..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ScorerIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Scorer identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class ScorerIdentifier(override val name: String) - extends ComponentIdentifier("Scorer", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[ScorerIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: ScorerIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object ScorerIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): ScorerIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new ScorerIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal ScorerIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ScoringPipelineIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ScoringPipelineIdentifier.docx new file mode 100644 index 000000000..81528e1b4 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ScoringPipelineIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ScoringPipelineIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ScoringPipelineIdentifier.scala deleted file mode 100644 index 3b2fbdb86..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/ScoringPipelineIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Scoring Pipeline identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class ScoringPipelineIdentifier(override val name: String) - extends ComponentIdentifier("ScoringPipeline", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[ScoringPipelineIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: ScoringPipelineIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object ScoringPipelineIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): ScoringPipelineIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new ScoringPipelineIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal ScoringPipelineIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/SelectorIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/SelectorIdentifier.docx new file mode 100644 index 000000000..ca0027bf3 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/SelectorIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/SelectorIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/SelectorIdentifier.scala deleted file mode 100644 index 5e04d394b..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/SelectorIdentifier.scala +++ /dev/null @@ -1,79 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Selector identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class SelectorIdentifier(override val name: String) - extends ComponentIdentifier("Selector", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[SelectorIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: SelectorIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -/** - * Used in `SelectorExecutor` to give an ID to each selector in the `ComponentIdentifierStack` - * - * These are often generated automatically in the executor and are dependent on the class names - * so we skip validation to avoid issues. Since we dont record stats for Selectors this is okay. - */ -private[core] object SelectorIdentifier { - def apply( - name: String, - index: Int - )( - implicit sourceFile: sourcecode.File - ): SelectorIdentifier = { - val capitalizedWithoutSpecialCharacters = name.replace("$", "").capitalize - new SelectorIdentifier(index.toString + capitalizedWithoutSpecialCharacters) { - override val file: sourcecode.File = sourceFile - } - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/SideEffectIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/SideEffectIdentifier.docx new file mode 100644 index 000000000..80714dfe3 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/SideEffectIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/SideEffectIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/SideEffectIdentifier.scala deleted file mode 100644 index 4775721b6..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/SideEffectIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Side Effect identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class SideEffectIdentifier(override val name: String) - extends ComponentIdentifier("SideEffect", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[SideEffectIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: SideEffectIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object SideEffectIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): SideEffectIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new SideEffectIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal SideEffectIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/TransformerIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/TransformerIdentifier.docx new file mode 100644 index 000000000..8c6837698 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/TransformerIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/TransformerIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/TransformerIdentifier.scala deleted file mode 100644 index e336c4460..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/TransformerIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Transformer identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class TransformerIdentifier(override val name: String) - extends ComponentIdentifier("Transformer", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[TransformerIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: TransformerIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object TransformerIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): TransformerIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new TransformerIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal TransformerIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/TransportMarshallerIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/TransportMarshallerIdentifier.docx new file mode 100644 index 000000000..23ca438b0 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/TransportMarshallerIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/TransportMarshallerIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/TransportMarshallerIdentifier.scala deleted file mode 100644 index 07f7d8d76..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier/TransportMarshallerIdentifier.scala +++ /dev/null @@ -1,70 +0,0 @@ -package com.twitter.product_mixer.core.model.common.identifier - -/** - * Transport Marshaller identifier - * - * @note This class should always remain effectively `final`. If for any reason the `sealed` - * modifier is removed, the equals() implementation must be updated in order to handle class - * inheritor equality (see note on the equals method below) - */ -sealed abstract class TransportMarshallerIdentifier(override val name: String) - extends ComponentIdentifier("TransportMarshaller", name) { - - /** - * @inheritdoc - */ - override def canEqual(that: Any): Boolean = that.isInstanceOf[TransportMarshallerIdentifier] - - /** - * High performance implementation of equals method that leverages: - * - Referential equality short circuit - * - Cached hashcode equality short circuit - * - Field values are only checked if the hashCodes are equal to handle the unlikely case - * of a hashCode collision - * - Removal of check for `that` being an equals-compatible descendant since this class is final - * - * @note `candidate.canEqual(this)` is not necessary because this class is final - * @see [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, - * Chapter 28]] for discussion and design. - */ - override def equals(that: Any): Boolean = - that match { - case identifier: TransportMarshallerIdentifier => - // Note identifier.canEqual(this) is not necessary because this class is effectively final - ((this eq identifier) - || ((hashCode == identifier.hashCode) && ((componentType == identifier.componentType) && (name == identifier.name)))) - case _ => - false - } - - /** - * Leverage domain-specific constraints (see notes below) to safely construct and cache the - * hashCode as a val, such that it is instantiated once on object construction. This prevents the - * need to recompute the hashCode on each hashCode() invocation, which is the behavior of the - * Scala compiler case class-generated hashCode() since it cannot make assumptions regarding field - * object mutability and hashCode implementations. - * - * @note Caching the hashCode is only safe if all of the fields used to construct the hashCode - * are immutable. This includes: - * - Inability to mutate the object reference on for an existing instantiated identifier - * (i.e. each field is a val) - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * - Inability to mutate the field object instance itself (i.e. each field is an immutable - * data structure), assuming stable hashCode implementations for these objects - * - * @note In order for the hashCode to be consistent with object equality, `##` must be used for - * boxed numeric types and null. As such, always prefer `.##` over `.hashCode()`. - */ - override val hashCode: Int = 31 * componentType.## + name.## -} - -object TransportMarshallerIdentifier { - def apply(name: String)(implicit sourceFile: sourcecode.File): TransportMarshallerIdentifier = { - if (ComponentIdentifier.isValidName(name)) - new TransportMarshallerIdentifier(name) { - override val file: sourcecode.File = sourceFile - } - else - throw new IllegalArgumentException(s"Illegal TransportMarshallerIdentifier: $name") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/BUILD deleted file mode 100644 index 506c23b1b..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/BUILD +++ /dev/null @@ -1,19 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/feature", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/pipeline_failure", - ], - exports = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/feature", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/scorer", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/pipeline_failure", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/BUILD.docx new file mode 100644 index 000000000..154d13dcb Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/CandidateFeatures.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/CandidateFeatures.docx new file mode 100644 index 000000000..3f0fcb690 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/CandidateFeatures.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/CandidateFeatures.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/CandidateFeatures.scala deleted file mode 100644 index 65f476af5..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/CandidateFeatures.scala +++ /dev/null @@ -1,32 +0,0 @@ -package com.twitter.product_mixer.core.model.common.presentation - -import com.twitter.product_mixer.core.feature.Feature -import com.twitter.product_mixer.core.model.common.UniversalNoun -import com.twitter.product_mixer.core.model.common.identifier.CandidatePipelineIdentifier -import com.twitter.product_mixer.core.model.common.identifier.CandidateSourceIdentifier -import scala.collection.immutable.ListSet - -/** - * A list set of all the candidate pipelines a candidate originated from. This is typically a - * single element set, but merging candidates across pipelines using - * [[com.twitter.product_mixer.component_library.selector.CombineFeatureMapsCandidateMerger]] - * will merge sets for the candidate. The last element of the set is the first pipeline identifier - * as we prepend new ones since we want O(1) access for the last element. - */ -object CandidatePipelines extends Feature[UniversalNoun[Any], ListSet[CandidatePipelineIdentifier]] - -/** - * A list set of all the candidate sources a candidate originated from. This is typically a - * single element set, but merging candidates across pipelines using - * [[com.twitter.product_mixer.component_library.selector.CombineFeatureMapsCandidateMerger]] - * will merge sets for the candidate. The last element of the set is the first source identifier - * as we prepend new ones since we want O(1) access for the last element. - */ -object CandidateSources extends Feature[UniversalNoun[Any], ListSet[CandidateSourceIdentifier]] - -/** - * The source position relative to all candidates the originating candidate source a candidate - * came from. When merged with other candidates, the position from the first candidate source - * takes priority. - */ -object CandidateSourcePosition extends Feature[UniversalNoun[Any], Int] diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/CandidateWithDetails.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/CandidateWithDetails.docx new file mode 100644 index 000000000..d2bd02b74 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/CandidateWithDetails.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/CandidateWithDetails.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/CandidateWithDetails.scala deleted file mode 100644 index ff6297a92..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/CandidateWithDetails.scala +++ /dev/null @@ -1,140 +0,0 @@ -package com.twitter.product_mixer.core.model.common.presentation - -import com.twitter.product_mixer.core.feature.featuremap.FeatureMap -import com.twitter.product_mixer.core.feature.featuremap.FeatureMapBuilder -import com.twitter.product_mixer.core.model.common.CandidateWithFeatures -import com.twitter.product_mixer.core.model.common.UniversalNoun -import com.twitter.product_mixer.core.model.common.identifier.CandidatePipelineIdentifier -import com.twitter.product_mixer.core.pipeline.pipeline_failure.PipelineFailure -import com.twitter.product_mixer.core.pipeline.pipeline_failure.UnexpectedCandidateResult -import scala.collection.immutable.ListSet -import scala.reflect.ClassTag - -sealed trait CandidateWithDetails { self => - def presentation: Option[UniversalPresentation] - def features: FeatureMap - - // last of the set because in ListSet, the last element is the first inserted one with O(1) - // access - lazy val source: CandidatePipelineIdentifier = features.get(CandidatePipelines).last - lazy val sourcePosition: Int = features.get(CandidateSourcePosition) - - /** - * @see [[getCandidateId]] - */ - def candidateIdLong: Long = getCandidateId[Long] - - /** - * @see [[getCandidateId]] - */ - def candidateIdString: String = getCandidateId[String] - - /** - * Convenience method for retrieving a candidate ID off of the base [[CandidateWithDetails]] trait - * without manually pattern matching. - * - * @throws PipelineFailure if CandidateIdType does not match the expected Item Candidate Id type, - * or if invoked on a Module Candidate - */ - def getCandidateId[CandidateIdType]( - )( - implicit tag: ClassTag[CandidateIdType] - ): CandidateIdType = - self match { - case item: ItemCandidateWithDetails => - item.candidate.id match { - case id: CandidateIdType => id - case _ => - throw PipelineFailure( - UnexpectedCandidateResult, - s"Invalid Item Candidate ID type expected $tag for Item Candidate type ${item.candidate.getClass}") - } - case _: ModuleCandidateWithDetails => - throw PipelineFailure( - UnexpectedCandidateResult, - "Cannot retrieve Item Candidate ID for a Module") - } - - /** - * Convenience method for retrieving a candidate off of the base [[CandidateWithDetails]] trait - * without manually pattern matching. - * - * @throws PipelineFailure if CandidateType does not match the expected Item Candidate type, or - * if invoked on a Module Candidate - */ - def getCandidate[CandidateType <: UniversalNoun[_]]( - )( - implicit tag: ClassTag[CandidateType] - ): CandidateType = - self match { - case ItemCandidateWithDetails(candidate: CandidateType, _, _) => candidate - case item: ItemCandidateWithDetails => - throw PipelineFailure( - UnexpectedCandidateResult, - s"Invalid Item Candidate type expected $tag for Item Candidate type ${item.candidate.getClass}") - case _: ModuleCandidateWithDetails => - throw PipelineFailure( - UnexpectedCandidateResult, - "Cannot retrieve Item Candidate for a Module") - } - - /** - * Convenience method for checking if this contains a certain candidate type - * - * @throws PipelineFailure if CandidateType does not match the expected Item Candidate type, or - * if invoked on a Module Candidate - */ - def isCandidateType[CandidateType <: UniversalNoun[_]]( - )( - implicit tag: ClassTag[CandidateType] - ): Boolean = self match { - case ItemCandidateWithDetails(_: CandidateType, _, _) => true - case _ => false - } -} - -case class ItemCandidateWithDetails( - override val candidate: UniversalNoun[Any], - presentation: Option[UniversalPresentation], - override val features: FeatureMap) - extends CandidateWithDetails - with CandidateWithFeatures[UniversalNoun[Any]] - -case class ModuleCandidateWithDetails( - candidates: Seq[ItemCandidateWithDetails], - presentation: Option[ModulePresentation], - override val features: FeatureMap) - extends CandidateWithDetails - -object ItemCandidateWithDetails { - def apply( - candidate: UniversalNoun[Any], - presentation: Option[UniversalPresentation], - source: CandidatePipelineIdentifier, - sourcePosition: Int, - features: FeatureMap - ): ItemCandidateWithDetails = { - val newFeatureMap = - FeatureMapBuilder() - .add(CandidateSourcePosition, sourcePosition) - .add(CandidatePipelines, ListSet.empty + source).build() ++ features - ItemCandidateWithDetails(candidate, presentation, newFeatureMap) - } -} - -object ModuleCandidateWithDetails { - def apply( - candidates: Seq[ItemCandidateWithDetails], - presentation: Option[ModulePresentation], - source: CandidatePipelineIdentifier, - sourcePosition: Int, - features: FeatureMap - ): ModuleCandidateWithDetails = { - val newFeatureMap = - FeatureMapBuilder() - .add(CandidateSourcePosition, sourcePosition) - .add(CandidatePipelines, ListSet.empty + source).build() ++ features - - ModuleCandidateWithDetails(candidates, presentation, newFeatureMap) - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ItemPresentation.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ItemPresentation.docx new file mode 100644 index 000000000..9f3c0b951 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ItemPresentation.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ItemPresentation.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ItemPresentation.scala deleted file mode 100644 index 93f86e2b4..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ItemPresentation.scala +++ /dev/null @@ -1,6 +0,0 @@ -package com.twitter.product_mixer.core.model.common.presentation - -trait ItemPresentation extends UniversalPresentation { - // Optional field which if populated, will group the items into the specified module - def modulePresentation: Option[ModulePresentation] = None -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ModulePresentation.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ModulePresentation.docx new file mode 100644 index 000000000..6025ab6fd Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ModulePresentation.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ModulePresentation.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ModulePresentation.scala deleted file mode 100644 index dff815c8a..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ModulePresentation.scala +++ /dev/null @@ -1,3 +0,0 @@ -package com.twitter.product_mixer.core.model.common.presentation - -trait ModulePresentation extends UniversalPresentation diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/UniversalPresentation.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/UniversalPresentation.docx new file mode 100644 index 000000000..62011057e Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/UniversalPresentation.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/UniversalPresentation.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/UniversalPresentation.scala deleted file mode 100644 index d206c5b23..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/UniversalPresentation.scala +++ /dev/null @@ -1,16 +0,0 @@ -package com.twitter.product_mixer.core.model.common.presentation - -/** - * Encapsulates information about how to present a Candidate - * - * Implementations of a [[UniversalPresentation]] contain information about how to present the Candidate. - * This extra information can be in fields in the implementations or in their types. - * - * For instance, a Tweet candidate that will be displayed as a URT Tweet Item will be decorated with a - * [[UniversalPresentation]] implementation that reflects the presentation such as - * [[com.twitter.product_mixer.component_library.model.presentation.urt.UrtItemPresentation]] - * - * @see [[com.twitter.product_mixer.core.functional_component.decorator.CandidateDecorator]] for associating a - * [[UniversalPresentation]] with a Candidate. - */ -trait UniversalPresentation diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BUILD deleted file mode 100644 index 67ebe01c4..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BUILD +++ /dev/null @@ -1,15 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice", - ], - exports = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BUILD.docx new file mode 100644 index 000000000..9958569ab Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BaseSliceItemPresentation.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BaseSliceItemPresentation.docx new file mode 100644 index 000000000..686c04761 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BaseSliceItemPresentation.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BaseSliceItemPresentation.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BaseSliceItemPresentation.scala deleted file mode 100644 index dedb450ce..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BaseSliceItemPresentation.scala +++ /dev/null @@ -1,8 +0,0 @@ -package com.twitter.product_mixer.core.model.common.presentation.slice - -import com.twitter.product_mixer.core.model.common.presentation.ItemPresentation -import com.twitter.product_mixer.core.model.marshalling.response.slice.SliceItem - -trait BaseSliceItemPresentation extends ItemPresentation { - def sliceItem: SliceItem -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BUILD deleted file mode 100644 index b9923428d..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BUILD +++ /dev/null @@ -1,15 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt", - ], - exports = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BUILD.docx new file mode 100644 index 000000000..e2e91ae16 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtItemPresentation.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtItemPresentation.docx new file mode 100644 index 000000000..9f197b50c Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtItemPresentation.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtItemPresentation.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtItemPresentation.scala deleted file mode 100644 index 7e1f87bef..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtItemPresentation.scala +++ /dev/null @@ -1,9 +0,0 @@ -package com.twitter.product_mixer.core.model.common.presentation.urt - -import com.twitter.product_mixer.core.model.common.presentation.ItemPresentation -import com.twitter.product_mixer.core.model.marshalling.response.urt.TimelineItem - -trait BaseUrtItemPresentation extends ItemPresentation { - - def timelineItem: TimelineItem -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtModulePresentation.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtModulePresentation.docx new file mode 100644 index 000000000..532ed294a Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtModulePresentation.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtModulePresentation.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtModulePresentation.scala deleted file mode 100644 index d1a774499..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtModulePresentation.scala +++ /dev/null @@ -1,8 +0,0 @@ -package com.twitter.product_mixer.core.model.common.presentation.urt - -import com.twitter.product_mixer.core.model.common.presentation.ModulePresentation -import com.twitter.product_mixer.core.model.marshalling.response.urt.TimelineModule - -trait BaseUrtModulePresentation extends ModulePresentation { - def timelineModule: TimelineModule -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtOperationPresentation.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtOperationPresentation.docx new file mode 100644 index 000000000..2235deb7c Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtOperationPresentation.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtOperationPresentation.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtOperationPresentation.scala deleted file mode 100644 index 0d0a74da3..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtOperationPresentation.scala +++ /dev/null @@ -1,9 +0,0 @@ -package com.twitter.product_mixer.core.model.common.presentation.urt - -import com.twitter.product_mixer.core.model.common.presentation.ItemPresentation -import com.twitter.product_mixer.core.model.marshalling.response.urt.TimelineOperation - -trait BaseUrtOperationPresentation extends ItemPresentation { - - def timelineOperation: TimelineOperation -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/IsDispensable.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/IsDispensable.docx new file mode 100644 index 000000000..6ae891b5c Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/IsDispensable.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/IsDispensable.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/IsDispensable.scala deleted file mode 100644 index 33ff69c21..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/IsDispensable.scala +++ /dev/null @@ -1,14 +0,0 @@ -package com.twitter.product_mixer.core.model.common.presentation.urt - -/** - * Whether an item is considered dispensable within a module. - * Dispensable module items should never be left as the final remaining - * items within a module. Whenever a module would be left with only - * dispensable contents (through removal or dismissal of other items) the - * entire module should be discarded as if contained 0 items. - * - * @see http://go/urtDispensableModuleItems - */ -trait IsDispensable { self: BaseUrtItemPresentation => - def dispensable: Boolean -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/WithItemTreeDisplay.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/WithItemTreeDisplay.docx new file mode 100644 index 000000000..73e983fbe Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/WithItemTreeDisplay.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/WithItemTreeDisplay.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/WithItemTreeDisplay.scala deleted file mode 100644 index 0235a20de..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/WithItemTreeDisplay.scala +++ /dev/null @@ -1,11 +0,0 @@ -package com.twitter.product_mixer.core.model.common.presentation.urt - -import com.twitter.product_mixer.core.model.marshalling.response.urt.ModuleItemTreeDisplay - -/* - * Tree state declaring item’s parent relationship with any other items in - * the module, any display indentation information, and/or collapsed display state. - */ -trait WithItemTreeDisplay { self: BaseUrtItemPresentation => - def treeDisplay: Option[ModuleItemTreeDisplay] -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/BUILD deleted file mode 100644 index c9ed8c7eb..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/BUILD +++ /dev/null @@ -1,8 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/BUILD.docx new file mode 100644 index 000000000..5f32b8af1 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/HasMarshalling.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/HasMarshalling.docx new file mode 100644 index 000000000..100a7ccec Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/HasMarshalling.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/HasMarshalling.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/HasMarshalling.scala deleted file mode 100644 index 5158523ee..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/HasMarshalling.scala +++ /dev/null @@ -1,3 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling - -trait HasMarshalling diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/BUILD deleted file mode 100644 index 790abac6d..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/BUILD +++ /dev/null @@ -1,24 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "3rdparty/jvm/com/fasterxml/jackson:jackson-module-scala", - "3rdparty/jvm/com/fasterxml/jackson/core:jackson-annotations", - "configapi/configapi-core/src/main/scala/com/twitter/timelines/configapi", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/identifier", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/pipeline_failure", - "util/util-core:util-core-util", - ], - exports = [ - "3rdparty/jvm/com/fasterxml/jackson:jackson-module-scala", - "3rdparty/jvm/com/fasterxml/jackson/core:jackson-annotations", - "configapi/configapi-core/src/main/scala/com/twitter/timelines/configapi", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling", - "util/util-core:util-core-util", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/BUILD.docx new file mode 100644 index 000000000..37029c7da Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ClientContext.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ClientContext.docx new file mode 100644 index 000000000..90b0bf82a Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ClientContext.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ClientContext.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ClientContext.scala deleted file mode 100644 index 31ba2ad04..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ClientContext.scala +++ /dev/null @@ -1,94 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.request - -import com.fasterxml.jackson.annotation.JsonIgnore -import com.twitter.product_mixer.core.pipeline.pipeline_failure.BadRequest -import com.twitter.product_mixer.core.pipeline.pipeline_failure.PipelineFailure - -/** - * ClientContext contains fields related to the client making the request. - */ -case class ClientContext( - userId: Option[Long], - guestId: Option[Long], - guestIdAds: Option[Long], - guestIdMarketing: Option[Long], - appId: Option[Long], - ipAddress: Option[String], - userAgent: Option[String], - countryCode: Option[String], - languageCode: Option[String], - isTwoffice: Option[Boolean], - userRoles: Option[Set[String]], - deviceId: Option[String], - mobileDeviceId: Option[String], - mobileDeviceAdId: Option[String], - limitAdTracking: Option[Boolean]) - -object ClientContext { - val empty: ClientContext = ClientContext( - userId = None, - guestId = None, - guestIdAds = None, - guestIdMarketing = None, - appId = None, - ipAddress = None, - userAgent = None, - countryCode = None, - languageCode = None, - isTwoffice = None, - userRoles = None, - deviceId = None, - mobileDeviceId = None, - mobileDeviceAdId = None, - limitAdTracking = None - ) -} - -/** - * HasClientContext indicates that a request has [[ClientContext]] and adds helper functions for - * accessing [[ClientContext]] fields. - */ -trait HasClientContext { - def clientContext: ClientContext - - /** - * getRequiredUserId returns a userId and throw if it's missing. - * - * @note logged out requests are disabled by default so this is safe for most products - */ - @JsonIgnore /** Jackson tries to serialize this method, throwing an exception for guest products */ - def getRequiredUserId: Long = clientContext.userId.getOrElse( - throw PipelineFailure(BadRequest, "Missing required field: userId")) - - /** - * getOptionalUserId returns a userId if one is set - */ - def getOptionalUserId: Option[Long] = clientContext.userId - - /** - * getUserIdLoggedOutSupport returns a userId and falls back to 0 if none is set - */ - def getUserIdLoggedOutSupport: Long = clientContext.userId.getOrElse(0L) - - /** - * getUserOrGuestId returns a userId or a guestId if no userId has been set - */ - def getUserOrGuestId: Option[Long] = clientContext.userId.orElse(clientContext.guestId) - - /** - * getCountryCode returns a country code if one is set - */ - def getCountryCode: Option[String] = clientContext.countryCode - - /** - * getLanguageCode returns a language code if one is set - */ - def getLanguageCode: Option[String] = clientContext.languageCode - - /** - * isLoggedOut returns true if the user is logged out (no userId present). - * - * @note this can be useful in conjunction with [[getUserIdLoggedOutSupport]] - */ - def isLoggedOut: Boolean = clientContext.userId.isEmpty -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugOptions.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugOptions.docx new file mode 100644 index 000000000..81fe2689f Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugOptions.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugOptions.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugOptions.scala deleted file mode 100644 index 7347e333b..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugOptions.scala +++ /dev/null @@ -1,15 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.request - -import com.twitter.util.Time - -trait DebugOptions { - // Manually override the request time which is useful for writing deterministic Feature tests, - // since Feature tests do not support mocking Time. For example, URT sort indexes start with a - // Snowflake ID based on request time if no initialSortIndex is set on the request cursor, so to - // write a Feature test for this scenario, we can manually set the request time to use here. - def requestTimeOverride: Option[Time] = None -} - -trait HasDebugOptions { - def debugOptions: Option[DebugOptions] -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugParams.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugParams.docx new file mode 100644 index 000000000..1b2a8eb9a Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugParams.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugParams.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugParams.scala deleted file mode 100644 index 1c951cbf3..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugParams.scala +++ /dev/null @@ -1,8 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.request - -import com.twitter.timelines.configapi.{FeatureValue => ConfigApiFeatureValue} - -case class DebugParams( - featureOverrides: Option[Map[String, ConfigApiFeatureValue]], - override val debugOptions: Option[DebugOptions]) - extends HasDebugOptions diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasExcludedIds.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasExcludedIds.docx new file mode 100644 index 000000000..6f1268840 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasExcludedIds.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasExcludedIds.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasExcludedIds.scala deleted file mode 100644 index 40f60fc7c..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasExcludedIds.scala +++ /dev/null @@ -1,8 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.request - -/** - * Allow clients to pass in a set of IDs that would be excluded from the results. - */ -trait HasExcludedIds { - val excludedIds: Set[Long] = Set.empty -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasSerializedRequestCursor.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasSerializedRequestCursor.docx new file mode 100644 index 000000000..f1348cbd8 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasSerializedRequestCursor.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasSerializedRequestCursor.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasSerializedRequestCursor.scala deleted file mode 100644 index e52f2bcde..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasSerializedRequestCursor.scala +++ /dev/null @@ -1,11 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.request - -/** - * serializedRequestCursor is any serialized representation of a cursor. - * - * The serialized representation is implementation-specific but will often be a base 64 - * representation of a Thrift struct. Cursors should not be deserialized in the unmarshaller. - */ -trait HasSerializedRequestCursor { - def serializedRequestCursor: Option[String] -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Product.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Product.docx new file mode 100644 index 000000000..a07f7c366 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Product.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Product.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Product.scala deleted file mode 100644 index 7afb2eefe..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Product.scala +++ /dev/null @@ -1,25 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.request - -import com.twitter.product_mixer.core.model.common.Component -import com.twitter.product_mixer.core.model.common.identifier.ProductIdentifier - -trait Product extends Component { - - /** - * Identifier names on products can be used to create Feature Switch rules by product, - * which useful if bucketing occurs in a component shared by multiple products. - * - * @see [[com.twitter.product_mixer.core.product.ProductParamConfig.supportedClientFSName]] - */ - override val identifier: ProductIdentifier - - /** - * To support StringCenter, override this val to `Some("name-of-string-center-project")` and - * include the `ProductScopeStringCenterModule` in the server's modules list - */ - val stringCenterProject: Option[String] = None -} - -trait HasProduct { - def product: Product -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ProductContext.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ProductContext.docx new file mode 100644 index 000000000..1041c1a8c Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ProductContext.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ProductContext.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ProductContext.scala deleted file mode 100644 index 71a0d66ea..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ProductContext.scala +++ /dev/null @@ -1,7 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.request - -trait ProductContext - -trait HasProductContext { - def productContext: Option[ProductContext] -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Request.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Request.docx new file mode 100644 index 000000000..7b7a8339d Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Request.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Request.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Request.scala deleted file mode 100644 index 7dfcf4e4d..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Request.scala +++ /dev/null @@ -1,10 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.request - -trait Request - extends HasClientContext - with HasProduct - with HasProductContext - with HasSerializedRequestCursor { - def maxResults: Option[Int] - def debugParams: Option[DebugParams] -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/rtf/safety_level/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/rtf/safety_level/BUILD deleted file mode 100644 index e37672b5c..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/rtf/safety_level/BUILD +++ /dev/null @@ -1,13 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling", - ], - exports = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/rtf/safety_level/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/rtf/safety_level/BUILD.docx new file mode 100644 index 000000000..77dee980f Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/rtf/safety_level/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/rtf/safety_level/SafetyLevel.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/rtf/safety_level/SafetyLevel.docx new file mode 100644 index 000000000..6d4a82080 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/rtf/safety_level/SafetyLevel.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/rtf/safety_level/SafetyLevel.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/rtf/safety_level/SafetyLevel.scala deleted file mode 100644 index b0709285a..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/rtf/safety_level/SafetyLevel.scala +++ /dev/null @@ -1,13 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.rtf.safety_level - -/* - These are model objects for the thrift enum - src/thrift/com/twitter/spam/rtf/safety_level.thrift - Please add new objects as needed for the marhallers - */ -sealed trait SafetyLevel - -case object ConversationFocalTweetSafetyLevel extends SafetyLevel -case object ConversationReplySafetyLevel extends SafetyLevel -case object ConversationInjectedTweetSafetyLevel extends SafetyLevel -case object TimelineFocalTweetSafetyLevel extends SafetyLevel -case object TimelineHomePromotedHydrationSafetyLevel extends SafetyLevel diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice/BUILD deleted file mode 100644 index e37672b5c..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice/BUILD +++ /dev/null @@ -1,13 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling", - ], - exports = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice/BUILD.docx new file mode 100644 index 000000000..77dee980f Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice/SliceItem.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice/SliceItem.docx new file mode 100644 index 000000000..53b8b4f11 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice/SliceItem.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice/SliceItem.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice/SliceItem.scala deleted file mode 100644 index 5891027a6..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/slice/SliceItem.scala +++ /dev/null @@ -1,84 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.slice - -import com.twitter.product_mixer.core.model.marshalling.HasMarshalling - -/** - * These are the Ad Types exposed on AdUnits - * - * They are to be kept in sync with strato/config/src/thrift/com/twitter/strato/graphql/hubble.thrift - */ -sealed trait AdType -object AdType { - case object Tweet extends AdType - case object Account extends AdType - case object InStreamVideo extends AdType - case object DisplayCreative extends AdType - case object Trend extends AdType - case object Spotlight extends AdType - case object Takeover extends AdType -} - -trait SliceItem -case class TweetItem(id: Long) extends SliceItem -case class UserItem(id: Long) extends SliceItem -case class TwitterListItem(id: Long) extends SliceItem -case class DMConvoSearchItem(id: String, lastReadableEventId: Option[Long]) extends SliceItem -case class DMEventItem(id: Long) extends SliceItem -case class DMConvoItem(id: String, lastReadableEventId: Option[Long]) extends SliceItem -case class DMMessageSearchItem(id: Long) extends SliceItem -case class TopicItem(id: Long) extends SliceItem -case class TypeaheadEventItem(eventId: Long, metadata: Option[TypeaheadMetadata]) extends SliceItem -case class TypeaheadQuerySuggestionItem(query: String, metadata: Option[TypeaheadMetadata]) - extends SliceItem -case class TypeaheadUserItem( - userId: Long, - metadata: Option[TypeaheadMetadata], - badges: Seq[UserBadge]) - extends SliceItem -case class AdItem(adUnitId: Long, adAccountId: Long) extends SliceItem -case class AdCreativeItem(creativeId: Long, adType: AdType, adAccountId: Long) extends SliceItem -case class AdGroupItem(adGroupId: Long, adAccountId: Long) extends SliceItem -case class CampaignItem(campaignId: Long, adAccountId: Long) extends SliceItem -case class FundingSourceItem(fundingSourceId: Long, adAccountId: Long) extends SliceItem - -sealed trait CursorType -case object PreviousCursor extends CursorType -case object NextCursor extends CursorType -@deprecated( - "GapCursors are not supported by Product Mixer Slice marshallers, if you need support for these reach out to #product-mixer") -case object GapCursor extends CursorType - -// CursorItem extends SliceItem to enable support for GapCursors -case class CursorItem(value: String, cursorType: CursorType) extends SliceItem - -case class SliceInfo( - previousCursor: Option[String], - nextCursor: Option[String]) - -case class Slice( - items: Seq[SliceItem], - sliceInfo: SliceInfo) - extends HasMarshalling - -sealed trait TypeaheadResultContextType -case object You extends TypeaheadResultContextType -case object Location extends TypeaheadResultContextType -case object NumFollowers extends TypeaheadResultContextType -case object FollowRelationship extends TypeaheadResultContextType -case object Bio extends TypeaheadResultContextType -case object NumTweets extends TypeaheadResultContextType -case object Trending extends TypeaheadResultContextType -case object HighlightedLabel extends TypeaheadResultContextType - -case class TypeaheadResultContext( - contextType: TypeaheadResultContextType, - displayString: String, - iconUrl: Option[String]) - -case class TypeaheadMetadata( - score: Double, - source: Option[String], - context: Option[TypeaheadResultContext]) - -// Used to render badges in Typeahead, such as Business-affiliated badges -case class UserBadge(badgeType: String, badgeUrl: String, description: String) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/BUILD deleted file mode 100644 index b0c058fe3..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/BUILD +++ /dev/null @@ -1,15 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt", - ], - exports = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/BUILD.docx new file mode 100644 index 000000000..45fff17af Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/Page.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/Page.docx new file mode 100644 index 000000000..b3641e9a8 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/Page.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/Page.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/Page.scala deleted file mode 100644 index df9656f85..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/Page.scala +++ /dev/null @@ -1,12 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.urp - -import com.twitter.product_mixer.core.model.marshalling.HasMarshalling -import com.twitter.product_mixer.core.model.marshalling.response.urt.TimelineScribeConfig - -case class Page( - id: String, - pageBody: PageBody, - scribeConfig: Option[TimelineScribeConfig] = None, - pageHeader: Option[PageHeader] = None, - pageNavBar: Option[PageNavBar] = None) - extends HasMarshalling diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageBody.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageBody.docx new file mode 100644 index 000000000..e4bf26fe6 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageBody.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageBody.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageBody.scala deleted file mode 100644 index 8f3a0ff96..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageBody.scala +++ /dev/null @@ -1,10 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.urp - -sealed trait PageBody - -case class TimelineKeyPageBody(timeline: TimelineKey) extends PageBody - -case class SegmentedTimelinesPageBody( - initialTimeline: SegmentedTimeline, - timelines: Seq[SegmentedTimeline]) - extends PageBody diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageHeader.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageHeader.docx new file mode 100644 index 000000000..7574ed264 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageHeader.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageHeader.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageHeader.scala deleted file mode 100644 index b39b36a99..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageHeader.scala +++ /dev/null @@ -1,15 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.urp - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ClientEventInfo -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.HasClientEventInfo - -sealed trait PageHeader - -case class TopicPageHeader( - topicId: String, - facepile: Option[TopicPageHeaderFacepile] = None, - override val clientEventInfo: Option[ClientEventInfo] = None, - landingContext: Option[String] = None, - displayType: Option[TopicPageHeaderDisplayType] = Some(BasicTopicPageHeaderDisplayType)) - extends PageHeader - with HasClientEventInfo diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageNavBar.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageNavBar.docx new file mode 100644 index 000000000..85a1dbe80 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageNavBar.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageNavBar.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageNavBar.scala deleted file mode 100644 index ee1d4d554..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageNavBar.scala +++ /dev/null @@ -1,19 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.urp - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ClientEventInfo -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.HasClientEventInfo - -sealed trait PageNavBar - -case class TopicPageNavBar( - topicId: String, - override val clientEventInfo: Option[ClientEventInfo] = None) - extends PageNavBar - with HasClientEventInfo - -case class TitleNavBar( - title: String, - subtitle: Option[String] = None, - override val clientEventInfo: Option[ClientEventInfo] = None) - extends PageNavBar - with HasClientEventInfo diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/SegmentedTimeline.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/SegmentedTimeline.docx new file mode 100644 index 000000000..bd86dd999 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/SegmentedTimeline.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/SegmentedTimeline.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/SegmentedTimeline.scala deleted file mode 100644 index a727376f4..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/SegmentedTimeline.scala +++ /dev/null @@ -1,10 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.urp - -import com.twitter.product_mixer.core.model.marshalling.response.urt.TimelineScribeConfig - -case class SegmentedTimeline( - id: String, - labelText: String, - timeline: TimelineKey, - scribeConfig: Option[TimelineScribeConfig] = None, - refreshIntervalSec: Option[Long] = None) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TimelineKey.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TimelineKey.docx new file mode 100644 index 000000000..d5184a3ed Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TimelineKey.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TimelineKey.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TimelineKey.scala deleted file mode 100644 index 6146693d1..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TimelineKey.scala +++ /dev/null @@ -1,32 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.urp - -sealed trait TimelineKey - -case class TopicsLandingTimeline(topicId: Option[String]) extends TimelineKey - -case class NoteworthyAccountsTimeline(topicId: Option[String]) extends TimelineKey - -case class TopicsPickerTimeline(topicId: Option[String]) extends TimelineKey - -case class NotInterestedTopicsMeTimeline() extends TimelineKey - -case class FollowedTopicsMeTimeline() extends TimelineKey - -case class FollowedTopicsOtherTimeline(userId: Long) extends TimelineKey - -case class NuxUserRecommendationsTimeline() extends TimelineKey - -case class NuxForYouCategoryUserRecommendationsTimeline() extends TimelineKey - -case class NuxPymkCategoryUserRecommendationsTimeline() extends TimelineKey - -case class NuxGeoCategoryUserRecommendationsTimeline() extends TimelineKey - -case class NuxSingleInterestCategoryUserRecommendationsTimeline(topicId: Option[String]) - extends TimelineKey - -case class ShoppingHomeTimeline() extends TimelineKey - -case class ForYouExploreMixerTimeline() extends TimelineKey - -case class TrendingExploreMixerTimeline() extends TimelineKey diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderDisplayType.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderDisplayType.docx new file mode 100644 index 000000000..7cbd43907 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderDisplayType.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderDisplayType.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderDisplayType.scala deleted file mode 100644 index 3ef6e3851..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderDisplayType.scala +++ /dev/null @@ -1,6 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.urp - -sealed trait TopicPageHeaderDisplayType - -case object BasicTopicPageHeaderDisplayType extends TopicPageHeaderDisplayType -case object PersonalizedTopicPageHeaderDisplayType extends TopicPageHeaderDisplayType diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderFacepile.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderFacepile.docx new file mode 100644 index 000000000..807859ed7 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderFacepile.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderFacepile.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderFacepile.scala deleted file mode 100644 index ce6599028..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderFacepile.scala +++ /dev/null @@ -1,7 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.urp - -import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.Url - -case class TopicPageHeaderFacepile( - userIds: Seq[Long], - facepileUrl: Option[Url] = None) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/BUILD b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/BUILD deleted file mode 100644 index 683520b2c..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/BUILD +++ /dev/null @@ -1,24 +0,0 @@ -scala_library( - sources = ["*.scala"], - compiler_option_sets = ["fatal_warnings"], - platform = "java8", - strict_deps = True, - tags = ["bazel-compatible"], - dependencies = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/alert", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/button", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/timeline_module", - "util/util-core:util-core-util", - ], - exports = [ - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/alert", - "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/timeline_module", - "util/util-core:util-core-util", - ], -) diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/BUILD.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/BUILD.docx new file mode 100644 index 000000000..edc1523ee Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/BUILD.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/Cover.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/Cover.docx new file mode 100644 index 000000000..a398ab491 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/Cover.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/Cover.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/Cover.scala deleted file mode 100644 index 568fa103f..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/Cover.scala +++ /dev/null @@ -1,3 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.urt - -trait Cover extends TimelineItem diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/EntryNamespace.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/EntryNamespace.docx new file mode 100644 index 000000000..d2fab1253 Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/EntryNamespace.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/EntryNamespace.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/EntryNamespace.scala deleted file mode 100644 index 53838658b..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/EntryNamespace.scala +++ /dev/null @@ -1,50 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.urt - -import scala.util.matching.Regex - -/** - * Entry Identifiers (commonly entry ids) are a type of identifier used in URT to identify - * unique timeline entries - tweets, users, modules, etc. - * - * Entry Identifiers are formed from two parts - a namespace (EntryNamespace) and an underlying - * id. - * - * A Entry Namespace is restricted to: - * - 3 to 60 characters to ensure reasonable length - * - a-z and dashes (kebab-case) - * - Examples include "user" and "tweet" - * - * When specific entries identifiers are created, they will be appended with a dash and their - * own id, like user-12 or tweet-20 - */ - -trait HasEntryNamespace { - val entryNamespace: EntryNamespace -} - -// sealed abstract case class is basically a scala 2.12 opaque type - -// you can only create them via the factory method on the companion -// allowing us to enforce validation -sealed abstract case class EntryNamespace(override val toString: String) - -object EntryNamespace { - val AllowedCharacters: Regex = "[a-z-]+".r // Allows for kebab-case - - def apply(str: String): EntryNamespace = { - val isValid = str match { - case n if n.length < 3 => - false - case n if n.length > 60 => - false - case AllowedCharacters() => - true - case _ => - false - } - - if (isValid) - new EntryNamespace(str) {} - else - throw new IllegalArgumentException(s"Illegal EntryNamespace: $str") - } -} diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/HasEntryIdentifier.docx b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/HasEntryIdentifier.docx new file mode 100644 index 000000000..e4b37f3fb Binary files /dev/null and b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/HasEntryIdentifier.docx differ diff --git a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/HasEntryIdentifier.scala b/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/HasEntryIdentifier.scala deleted file mode 100644 index 6008172c5..000000000 --- a/product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/HasEntryIdentifier.scala +++ /dev/null @@ -1,8 +0,0 @@ -package com.twitter.product_mixer.core.model.marshalling.response.urt - -import com.twitter.product_mixer.core.model.common.UniversalNoun - -trait HasEntryIdentifier extends UniversalNoun[Any] with HasEntryNamespace { - // Distinctly identifies this entry and must be unique relative to other entries within a response - lazy val entryIdentifier: String = s"$entryNamespace-$id" -}