namespace OpenTween.Api.GraphQL
{
- public class UserTweetsRequestTest
+ public class UserTweetsAndRepliesRequestTest
{
[Fact]
public async Task Send_Test()
{
- using var responseStream = File.OpenRead("Resources/Responses/UserTweets_SimpleTweet.json");
+ using var responseStream = File.OpenRead("Resources/Responses/UserTweetsAndReplies_SimpleTweet.json");
var mock = new Mock<IApiConnection>();
mock.Setup(x =>
)
.Callback<Uri, IDictionary<string, string>>((url, param) =>
{
- Assert.Equal(new("https://twitter.com/i/api/graphql/2GIWTr7XwadIixZDtyXd4A/UserTweets"), url);
- Assert.Equal(3, param.Count);
- Assert.Equal("""{"userId":"40480664","count":20,"includePromotedContent":true,"withQuickPromoteEligibilityTweetFields":true,"withVoice":true,"withV2Timeline":true}""", param["variables"]);
+ Assert.Equal(new("https://twitter.com/i/api/graphql/YlkSUg0mRBx7-EkxCvc-bw/UserTweetsAndReplies"), url);
+ Assert.Equal(2, param.Count);
+ Assert.Equal("""{"userId":"40480664","count":20,"includePromotedContent":true,"withCommunity":true,"withVoice":true,"withV2Timeline":true}""", param["variables"]);
Assert.True(param.ContainsKey("features"));
- Assert.True(param.ContainsKey("fieldToggles"));
})
.ReturnsAsync(responseStream);
- var request = new UserTweetsRequest(userId: "40480664")
+ var request = new UserTweetsAndRepliesRequest(userId: "40480664")
{
Count = 20,
};
[Fact]
public async Task Send_RequestCursor_Test()
{
- using var responseStream = File.OpenRead("Resources/Responses/UserTweets_SimpleTweet.json");
+ using var responseStream = File.OpenRead("Resources/Responses/UserTweetsAndReplies_SimpleTweet.json");
var mock = new Mock<IApiConnection>();
mock.Setup(x =>
)
.Callback<Uri, IDictionary<string, string>>((url, param) =>
{
- Assert.Equal(new("https://twitter.com/i/api/graphql/2GIWTr7XwadIixZDtyXd4A/UserTweets"), url);
- Assert.Equal(3, param.Count);
- Assert.Equal("""{"userId":"40480664","count":20,"includePromotedContent":true,"withQuickPromoteEligibilityTweetFields":true,"withVoice":true,"withV2Timeline":true,"cursor":"aaa"}""", param["variables"]);
+ Assert.Equal(new("https://twitter.com/i/api/graphql/YlkSUg0mRBx7-EkxCvc-bw/UserTweetsAndReplies"), url);
+ Assert.Equal(2, param.Count);
+ Assert.Equal("""{"userId":"40480664","count":20,"includePromotedContent":true,"withCommunity":true,"withVoice":true,"withV2Timeline":true,"cursor":"aaa"}""", param["variables"]);
Assert.True(param.ContainsKey("features"));
- Assert.True(param.ContainsKey("fieldToggles"));
})
.ReturnsAsync(responseStream);
- var request = new UserTweetsRequest(userId: "40480664")
+ var request = new UserTweetsAndRepliesRequest(userId: "40480664")
{
Count = 20,
Cursor = "aaa",
namespace OpenTween.Api.GraphQL
{
- public class UserTweetsRequest
+ public class UserTweetsAndRepliesRequest
{
- private static readonly Uri EndpointUri = new("https://twitter.com/i/api/graphql/2GIWTr7XwadIixZDtyXd4A/UserTweets");
+ private static readonly Uri EndpointUri = new("https://twitter.com/i/api/graphql/YlkSUg0mRBx7-EkxCvc-bw/UserTweetsAndReplies");
public string UserId { get; set; }
public string? Cursor { get; set; }
- public UserTweetsRequest(string userId)
+ public UserTweetsAndRepliesRequest(string userId)
=> this.UserId = userId;
public Dictionary<string, string> CreateParameters()
{
["variables"] = "{" +
$@"""userId"":""{JsonUtils.EscapeJsonString(this.UserId)}""," +
- $@"""count"":20," +
+ $@"""count"":{this.Count}," +
$@"""includePromotedContent"":true," +
- $@"""withQuickPromoteEligibilityTweetFields"":true," +
+ $@"""withCommunity"":true," +
$@"""withVoice"":true," +
$@"""withV2Timeline"":true" +
(this.Cursor != null ? $@",""cursor"":""{JsonUtils.EscapeJsonString(this.Cursor)}""" : "") +
"}",
["features"] = """
- {"rweb_lists_timeline_redesign_enabled":true,"responsive_web_graphql_exclude_directive_enabled":true,"verified_phone_label_enabled":false,"creator_subscriptions_tweet_preview_api_enabled":true,"responsive_web_graphql_timeline_navigation_enabled":true,"responsive_web_graphql_skip_user_profile_image_extensions_enabled":false,"tweetypie_unmention_optimization_enabled":true,"responsive_web_edit_tweet_api_enabled":true,"graphql_is_translatable_rweb_tweet_is_translatable_enabled":true,"view_counts_everywhere_api_enabled":true,"longform_notetweets_consumption_enabled":true,"responsive_web_twitter_article_tweet_consumption_enabled":false,"tweet_awards_web_tipping_enabled":false,"freedom_of_speech_not_reach_fetch_enabled":true,"standardized_nudges_misinfo":true,"tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled":true,"longform_notetweets_rich_text_read_enabled":true,"longform_notetweets_inline_media_enabled":true,"responsive_web_media_download_video_enabled":false,"responsive_web_enhance_cards_enabled":false}
- """,
- ["fieldToggles"] = """
- {"withAuxiliaryUserLabels":false,"withArticleRichContentState":false}
+ {"responsive_web_graphql_exclude_directive_enabled":true,"verified_phone_label_enabled":false,"responsive_web_home_pinned_timelines_enabled":true,"creator_subscriptions_tweet_preview_api_enabled":true,"responsive_web_graphql_timeline_navigation_enabled":true,"responsive_web_graphql_skip_user_profile_image_extensions_enabled":false,"c9s_tweet_anatomy_moderator_badge_enabled":true,"tweetypie_unmention_optimization_enabled":true,"responsive_web_edit_tweet_api_enabled":true,"graphql_is_translatable_rweb_tweet_is_translatable_enabled":true,"view_counts_everywhere_api_enabled":true,"longform_notetweets_consumption_enabled":true,"responsive_web_twitter_article_tweet_consumption_enabled":false,"tweet_awards_web_tipping_enabled":false,"freedom_of_speech_not_reach_fetch_enabled":true,"standardized_nudges_misinfo":true,"tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled":true,"longform_notetweets_rich_text_read_enabled":true,"longform_notetweets_inline_media_enabled":true,"responsive_web_media_download_video_enabled":false,"responsive_web_enhance_cards_enabled":false}
""",
};
}