public static async Task <string> FetchPostData(string token)
        {
            var profileDataJson = await Get("me?fields=id", token);

            var hubData = JsonConvert.DeserializeObject <HubData>(profileDataJson.ToString());

            var postDataJson = await Get("me/feed?limit=275", token);

            var postData = JsonConvert.DeserializeObject <FacebookPostResponse>(postDataJson.ToString());
            FacebookPostResponse lastPage = null;

            while (postData.PagingInfo != null)
            {
                postDataJson = await Get(postData.PagingInfo.Next, token);

                lastPage = postData;
                postData = JsonConvert.DeserializeObject <FacebookPostResponse>(postDataJson.ToString());
            }

            var firstPost = lastPage.Posts.OrderBy(p => DateTime.Parse(p.CreatedOn)).FirstOrDefault();

            hubData.Result = firstPost;

            return(hubData.Result.Id);
        }
示例#2
0
 /// <summary>
 /// Gets information about the post with the specified <code>id</code>.
 /// </summary>
 /// <param name="id">The ID of the post.</param>
 public FacebookPostResponse GetPost(string id)
 {
     return(FacebookPostResponse.ParseResponse(Raw.GetPost(id)));
 }