the-algorithm/home-mixer/server/src/main/scala/com/twitter/home_mixer/marshaller/timelines/DeviceContextMarshaller.scala
twitter-team ef4c5eb65e Twitter Recommendation Algorithm
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
2023-03-31 17:36:31 -05:00

35 lines
1.2 KiB
Scala

package com.twitter.home_mixer.marshaller.timelines
import com.twitter.home_mixer.model.request.DeviceContext
import com.twitter.product_mixer.core.model.marshalling.request.ClientContext
import com.twitter.timelineservice.{thriftscala => t}
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class DeviceContextMarshaller @Inject() () {
def apply(deviceContext: DeviceContext, clientContext: ClientContext): t.DeviceContext = {
t.DeviceContext(
countryCode = clientContext.countryCode,
languageCode = clientContext.languageCode,
clientAppId = clientContext.appId,
ipAddress = clientContext.ipAddress,
guestId = clientContext.guestId,
userAgent = clientContext.userAgent,
deviceId = clientContext.deviceId,
isPolling = deviceContext.isPolling,
requestContext = deviceContext.requestContext,
referrer = None,
tfeAuthHeader = None,
mobileDeviceId = clientContext.mobileDeviceId,
isSessionStart = None,
latestControlAvailable = deviceContext.latestControlAvailable,
guestIdMarketing = clientContext.guestIdMarketing,
isInternalOrTwoffice = clientContext.isTwoffice,
guestIdAds = clientContext.guestIdAds,
isUrtRequest = Some(true)
)
}
}