예제 #1
0
        public static XCFeedbackNotification GetCommonType(Feedback native)
        {
            XCFeedbackNotification xfeed = new XCFeedbackNotification();

            xfeed.TrackingInfo = new XCTrackingInfo();

            xfeed.NotificationMessage   = native.NotificationMessage;
            xfeed.Question              = native.Question;
            xfeed.TrackingInfo.RecipeId = native.TrackingInfo.RecipeId;
            xfeed.TrackingInfo.extras   = AdapterUtils.From(native.TrackingInfo.Metadata);
            xfeed.Id = native.Id;

            return(xfeed);
        }
예제 #2
0
        public static XCHistoryItem GetCommonType(HistoryItem nativeItem)
        {
            XCHistoryItem  item         = new XCHistoryItem();
            XCTrackingInfo trackingInfo = new XCTrackingInfo();

            trackingInfo.RecipeId = nativeItem.TrackingInfo.RecipeId;
            trackingInfo.extras   = AdapterUtils.From(nativeItem.TrackingInfo.Metadata);

            item.read      = nativeItem.Read;
            item.timestamp = nativeItem.Timestamp;

            item.trackingInfo = trackingInfo;

            if (nativeItem.Reaction is SimpleNotification simple)
            {
                item.reaction = AdapterSimple.GetCommonType(simple);
            }
            else if (nativeItem.Reaction is Content content)
            {
                item.reaction = AdapterContent.GetCommonType(content);
            }
            else if (nativeItem.Reaction is Feedback feedback)
            {
                item.reaction = AdapterFeedback.GetCommonType(feedback);
            }
            else if (nativeItem.Reaction is Coupon coupon)
            {
                item.reaction = AdapterCoupon.GetCommonType(coupon);
            }
            else if (nativeItem.Reaction is CustomJSON customJSON)
            {
                item.reaction = AdapterCustom.GetCommonType(customJSON);
            }

            return(item);
        }