Example #1
0
 internal static ReactionFeed Create(GfycatClient client, Model model, string searchText, RequestOptions options)
 {
     return(new ReactionFeed(client, searchText, options)
     {
         Content = model.Gfycats.Select(g => Gfy.Create(client, g)).ToReadOnlyCollection()
     });
 }
Example #2
0
        /// <summary>
        /// Gets info for a single Gfy
        /// </summary>
        /// <param name="gfycat"></param>
        /// <param name="overrideInvalidNameDetection">Forces the method to fetch the specified gfy even if it's detected as an invalid gfy name</param>
        /// <param name="options">The options for this request</param>
        /// <returns></returns>
        public async Task <Gfy> GetGfyAsync(string gfycat, bool overrideInvalidNameDetection = false, RequestOptions options = null)
        {
            if (!overrideInvalidNameDetection && !IsValidGfyName(gfycat))
            {
                return(null);
            }

            if (_clientAuth) // can I just say how much implicit auth is a pain the ass?
            {
                GfyResponse response = await ApiClient.GetGfyAsync(gfycat, options).ConfigureAwait(false);

                if (response == null)
                {
                    return(null);
                }

                return(Gfy.Create(this, response.GfyItem));
            }
            else
            {
                FullGfyResponse response = await ApiClient.GetFullGfyAsync(gfycat, options).ConfigureAwait(false);

                if (response == null)
                {
                    return(null);
                }

                return(Gfy.Create(this, response.Gfy));
            }
        }
Example #3
0
 internal static CurrentUserTimelineFeed Create(GfycatClient client, int count, RequestOptions defaultOptions, Feed feed)
 {
     return(new CurrentUserTimelineFeed(client, count, defaultOptions)
     {
         Content = feed.Gfycats.Select(g => Gfy.Create(client, g)).ToReadOnlyCollection(),
         _cursor = feed.Cursor
     });
 }
Example #4
0
 internal static CurrentUserSearchFeed Create(GfycatClient client, Model model, string searchText, RequestOptions options)
 {
     return(new CurrentUserSearchFeed(client, searchText, options)
     {
         Content = model.Gfycats.Select(g => Gfy.Create(client, g)).ToReadOnlyCollection(),
         _cursor = model.Cursor
     });
 }
Example #5
0
 internal static UserGfyFeed Create(GfycatClient client, RequestOptions defaultOptions, string userId, API.Models.Feed feed)
 {
     return(new UserGfyFeed(client, defaultOptions, userId)
     {
         Content = feed.Gfycats.Select(g => Gfy.Create(client, g)).ToReadOnlyCollection(),
         _cursor = feed.Cursor
     });
 }
 internal static TaggedGfyFeed Create(GfycatClient client, int count, Model trendingFeed, RequestOptions options)
 {
     return(new TaggedGfyFeed(client, count, options)
     {
         Content = trendingFeed.Gfycats.Select(g => Gfy.Create(client, g)).ToReadOnlyCollection(),
         Tag = trendingFeed.Tag,
         _cursor = trendingFeed.Cursor
     });
 }
 internal static SiteSearchFeed Create(GfycatClient client, Model model, int count, string searchText, RequestOptions options)
 {
     return(new SiteSearchFeed(client, count, searchText, options)
     {
         Content = model.Gfycats.Select(g => Gfy.Create(client, g)).ToReadOnlyCollection(),
         _cursor = model.Cursor,
         Count = model.Found
     });
 }
Example #8
0
 internal void Update(Model model)
 {
     Title               = model.Title;
     Count               = model.GfyCount;
     Content             = model.PublishedGfys.Select(g => Gfy.Create(Client, g)).ToReadOnlyCollection();
     CoverImageUrl       = model.CoverImageUrl;
     CoverImageUrlMobile = model.CoverImageUrlMobile;
     NsfwSetting         = model.Nsfw;
     Published           = model.Published;
     Order               = model.Order;
 }
Example #9
0
 internal void Update(Model model)
 {
     Title   = model.Title;
     Count   = model.GfyCount;
     Content = model.PublishedGfys.Select(g => Gfy.Create(Client, g)).ToReadOnlyCollection();
 }