-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ObsidianMinor/reactions-wip
Finished Reaction gifs implementation
- Loading branch information
Showing
18 changed files
with
191 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
using Model = Gfycat.API.Models.Feed; | ||
|
||
namespace Gfycat | ||
{ | ||
public class ReactionFeed : GfyFeed | ||
{ | ||
public string Tag { get; } | ||
|
||
internal ReactionFeed(GfycatClient client, string searchText, RequestOptions options) : base(client, options) | ||
{ | ||
Tag = searchText; | ||
} | ||
|
||
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() | ||
}; | ||
} | ||
|
||
public override IAsyncEnumerator<Gfy> GetEnumerator() | ||
{ | ||
return new SiteSearchEnumerator(_client, Tag, _options, this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma warning disable CS1591 | ||
namespace Gfycat | ||
{ | ||
public enum ReactionLanguage | ||
{ | ||
English, | ||
Russian, | ||
Japanese, | ||
SimplifiedChinese, | ||
TraditionalChinese, | ||
French, | ||
German, | ||
Spanish, | ||
Korean, | ||
Arabic, | ||
Farsi, | ||
Hebrew, | ||
Italian, | ||
Thai, | ||
Turkish, | ||
Vietnamese, | ||
Portuguese, | ||
HanChinese | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Model = Gfycat.API.Models.TrendingTagsFeed; | ||
|
||
namespace Gfycat | ||
{ | ||
public class ReactionTagsFeed : IFeed<ReactionFeed> | ||
{ | ||
readonly RequestOptions _defaultOptions; | ||
readonly GfycatClient _client; | ||
readonly ReactionLanguage _language; | ||
string IFeed<ReactionFeed>.Cursor => _cursor; | ||
internal string _cursor { get; set; } | ||
|
||
internal ReactionTagsFeed(GfycatClient client, RequestOptions defaultOptions, ReactionLanguage language) | ||
{ | ||
_defaultOptions = defaultOptions; | ||
_client = client; | ||
_language = language; | ||
} | ||
|
||
public IReadOnlyCollection<ReactionFeed> Content { get; private set; } | ||
|
||
internal static ReactionTagsFeed Create(GfycatClient client, RequestOptions options, Model model, ReactionLanguage lang) | ||
{ | ||
return new ReactionTagsFeed(client, options, lang) | ||
{ | ||
Content = model.Tags.Select(t => ReactionFeed.Create(client, t, t.Tag, options)).ToReadOnlyCollection(), | ||
_cursor = model.Cursor | ||
}; | ||
} | ||
|
||
public IAsyncEnumerator<ReactionFeed> GetEnumerator() | ||
{ | ||
return new ReactionTagsFeedEnumerator(_client, this, _defaultOptions, _language); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Gfycat | ||
{ | ||
internal class ReactionTagsFeedEnumerator : FeedEnumerator<ReactionFeed> | ||
{ | ||
readonly ReactionLanguage _lang; | ||
|
||
public ReactionTagsFeedEnumerator(GfycatClient client, IFeed<ReactionFeed> feed, RequestOptions defaultOptions, ReactionLanguage lang) : base(client, feed, defaultOptions) | ||
{ | ||
_lang = lang; | ||
} | ||
|
||
protected async override Task<IFeed<ReactionFeed>> GetNext(string cursor, RequestOptions options = null) | ||
{ | ||
return ReactionTagsFeed.Create(_client, options, await _client.ApiClient.GetReactionGifsPopulatedAsync(_lang, cursor, options), _lang); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters