Exemplo n.º 1
0
        private async Task <bool> LoadToCollectionAsync(FacebookCursor cursor = null, FacebookCursor.Direction direction = FacebookCursor.Direction.None)
        {
            try
            {
                var response = await _fbClient.GetAsync(_query, _token, cursor, direction);

                var results = response["data"];

                if (!results.Any())
                {
                    return(false);
                }

                foreach (var result in results)
                {
                    var mappedResult = Mapper(result);
                    Add(mappedResult);
                }

                var newCursor = response["paging"]["cursors"];
                var before    = newCursor["before"]?.ToString();
                var after     = newCursor["after"]?.ToString();
                Cursor = new FacebookCursor(before, after);

                return(true);
            }
            catch (Exception ex)
            {
                throw new FacebookCollectionException($"There was a problem loading additional items to Facebook collection {typeof(T)}", ex);
            }
        }
 public AppTestUsersCollection(FacebookClient client, string query, string token, FacebookCursor cursor = null) : base(client, query, token, TestUserMapper, cursor)
 {
 }
Exemplo n.º 3
0
 public FacebookCollection(FacebookClient client, string query, string token, Func <JToken, T> mapper, FacebookCursor cursor = null)
 {
     _fbClient = client;
     _query    = query;
     _token    = token;
     Mapper    = mapper;
 }
Exemplo n.º 4
0
 public PlacesCollection(FacebookClient client, string query, string token, FacebookCursor cursor = null) : base(client, query, token, PlaceMapper, cursor)
 {
 }