Exemple #1
0
 private void FillBloggerPostFromEntry(Entry entry, ref Blogger.Post post)
 {
     post.content     = NoNull(string.Format("<title>{0}</title>{1}", entry.Title, entry.Content));
     post.dateCreated = entry.CreatedUtc;
     post.postid      = NoNull(entry.EntryId);
     post.userid      = NoNull(entry.Author);
 }
Exemple #2
0
        public Blogger.Post blogger_getPost(string appKey, string postid, string username, string password)
        {
            if (!_dasBlogSettings.SiteConfiguration.EnableBloggerApi)
            {
                throw new ServiceDisabledException();
            }
            UserToken token = _siteSecurity.Login(username, password);

            if (token == null)
            {
                throw new System.Security.SecurityException();
            }

            Entry entry = _dataService.GetEntry(postid);

            if (entry != null)
            {
                Blogger.Post post = new Blogger.Post();
                FillBloggerPostFromEntry(entry, ref post);
                return(post);
            }
            else
            {
                return(new Blogger.Post());
            }
        }
Exemple #3
0
        public Blogger.Post[] blogger_getRecentPosts(string appKey, string blogid, string username, string password, int numberOfPosts)
        {
            if (!_dasBlogSettings.SiteConfiguration.EnableBloggerApi)
            {
                throw new ServiceDisabledException();
            }
            UserToken token = _siteSecurity.Login(username, password);

            if (token == null)
            {
                throw new SecurityException();
            }

            EntryCollection entries = _dataService.GetEntriesForDay(DateTime.Now.ToUniversalTime(), _dasBlogSettings.GetConfiguredTimeZone(),
                                                                    null, _dasBlogSettings.SiteConfiguration.RssDayCount, numberOfPosts, null);
            List <Blogger.Post> arrayList = new List <Blogger.Post>();

            foreach (Entry entry in entries)
            {
                Blogger.Post post = new Blogger.Post();
                FillBloggerPostFromEntry(entry, ref post);
                arrayList.Add(post);
            }
            return(arrayList.ToArray());
        }
Exemple #4
0
        public Blogger.Post blogger_getPost(string appKey, string postid, string username, string password)
        {
            if (!dasBlogSettings.SiteConfiguration.EnableBloggerApi)
            {
                throw new ServiceDisabledException();
            }

            if (!VerifyLogin(username, password))
            {
                throw new SecurityException();
            }

            var entry = dataService.GetEntry(postid);

            if (entry != null)
            {
                var post = new Blogger.Post();
                FillBloggerPostFromEntry(entry, ref post);
                return(post);
            }
            else
            {
                return(new Blogger.Post());
            }
        }