public static QuoteFmItem createFromApi(Recommendation recommendation)
        {
            if (recommendation == null)
            {
                return(null);
            }
            QuoteFmItem item = new QuoteFmItem();

            // Created At is missing!
            if (recommendation.article != null)
            {
                item.CreatedAt = recommendation.article.created.Value;
            }
            else
            {
                item.CreatedAt = DateTime.Now;
            }

            item.AuthorName  = recommendation.user.username;
            item.Id          = recommendation.id;
            item.Text        = recommendation.quote;
            item.QuoteType   = QuoteTypes.Recommendation;
            item.ClientName  = recommendation.domain.name;
            item.ArticleLink = recommendation.article.url;
            item.Author      = QuoteFmUser.createFromApi(recommendation.user);

            return(item);
        }
Beispiel #2
0
        public void  getFollowings()
        {
            ListOfUsers listOfFollwoings = QuoteSharp.API.getUsersListOfFollowings(this.username);

            Followings.Clear();
            foreach (User following in listOfFollwoings.entities)
            {
                Followings.Add(QuoteFmUser.createFromApi(following));
            }
        }
        public bool verifyCredentials()
        {
            User user = QuoteSharp.API.getUser(username);

            if (user != null)
            {
                this.User        = QuoteFmUser.createFromApi(user, getFollowings: true);
                LoginSuccessfull = true;
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static QuoteFmItem createFromApi(Article article)
        {
            if (article == null)
            {
                return(null);
            }
            if (article.topquote == null)
            {
                return(null);
            }
            QuoteFmItem item = new QuoteFmItem();

            item.CreatedAt = article.created.Value;

            item.Id          = article.id;
            item.AuthorName  = article.topquote.user.fullname;
            item.Text        = article.topquote.quote;
            item.QuoteType   = QuoteTypes.Recommendation;
            item.ClientName  = article.topquote.domain.name;
            item.ArticleLink = article.url;
            item.Author      = QuoteFmUser.createFromApi(article.topquote.user);

            return(item);
        }