mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-11-16 08:29:21 +01:00
[docx] split commit for file 2800
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
parent
8efd1b183b
commit
af50481590
Binary file not shown.
@ -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(_))
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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(_))
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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))
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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(_))
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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)
|
||||
)
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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))
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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(_)))
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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(_))
|
||||
)
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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)
|
||||
)
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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(_))
|
||||
)
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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(_))
|
||||
)
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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(_)))
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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)
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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)
|
||||
)
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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(_))
|
||||
)
|
||||
)
|
||||
|
||||
}
|
Binary file not shown.
@ -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
|
||||
)
|
||||
}
|
@ -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",
|
||||
],
|
||||
)
|
Binary file not shown.
Binary file not shown.
@ -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
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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))
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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(_))
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
)
|
||||
}
|
@ -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",
|
||||
],
|
||||
)
|
Binary file not shown.
Binary file not shown.
@ -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(_))
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
)
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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(_))
|
||||
)
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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
|
||||
)
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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,
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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(_))
|
||||
)
|
||||
}
|
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
Binary file not shown.
@ -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(_))))
|
||||
}
|
Binary file not shown.
@ -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
|
||||
)
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user