Beispiel #1
0
        public static FB_Attachment graphql_to_attachment(JToken data)
        {
            var _type = data.get("__typename")?.Value <string>();

            if (new string[] { "MessageImage", "MessageAnimatedImage" }.Contains(_type))
            {
                return(FB_ImageAttachment._from_graphql(data));
            }
            else if (_type == "MessageVideo")
            {
                return(FB_VideoAttachment._from_graphql(data));
            }
            else if (_type == "MessageAudio")
            {
                return(FB_AudioAttachment._from_graphql(data));
            }
            else if (_type == "MessageFile")
            {
                return(FB_FileAttachment._from_graphql(data));
            }
            else
            {
                return(new FB_Attachment(uid: data.get("legacy_attachment_id")?.Value <string>()));
            }
        }
Beispiel #2
0
        public static FB_Attachment graphql_to_subattachment(JToken data)
        {
            JToken target = data.get("target");
            string type   = target != null?target.get("__typename")?.Value <string>() : null;

            if (type == "Video")
            {
                return(FB_VideoAttachment._from_subattachment(data));
            }
            return(null);
        }