}
[Fact]
+ public async Task NoRetweetIds_Test()
+ {
+ using (var twitterApi = new TwitterApi())
+ {
+ var mock = new Mock<IApiConnection>();
+ mock.Setup(x =>
+ x.GetAsync<long[]>(
+ new Uri("friendships/no_retweets/ids.json", UriKind.Relative),
+ null,
+ "/friendships/no_retweets/ids")
+ )
+ .ReturnsAsync(new long[0]);
+
+ twitterApi.apiConnection = mock.Object;
+
+ await twitterApi.NoRetweetIds()
+ .ConfigureAwait(false);
+
+ mock.VerifyAll();
+ }
+ }
+
+ [Fact]
public async Task FollowersIds_Test()
{
using (var twitterApi = new TwitterApi())
return this.apiConnection.PostLazyAsync<TwitterFriendship>(endpoint, param);
}
+ public Task<long[]> NoRetweetIds(long? cursor = null)
+ {
+ var endpoint = new Uri("friendships/no_retweets/ids.json", UriKind.Relative);
+
+ return this.apiConnection.GetAsync<long[]>(endpoint, null, "/friendships/no_retweets/ids");
+ }
+
public Task<TwitterIds> FollowersIds(long? cursor = null)
{
var endpoint = new Uri("followers/ids.json", UriKind.Relative);
this.CreateApiCalllback("/saved_searches/list"));
}
- public HttpStatusCode NoRetweetIds(ref string content)
- {
- return httpCon.GetContent(GetMethod,
- this.CreateTwitterUri("/1.1/friendships/no_retweets/ids.json"),
- null,
- ref content,
- this.CreateRatelimitHeadersDict(),
- this.CreateApiCalllback("/friendships/no_retweets/ids"));
- }
-
public HttpStatusCode RateLimitStatus(ref string content)
{
return httpCon.GetContent(GetMethod,
await this.workerSemaphore.WaitAsync();
try
{
- await Task.Run(() => tw.RefreshNoRetweetIds());
+ await this.tw.RefreshNoRetweetIds();
this.StatusLabel.Text = "NoRetweetIds refreshed";
}
/// RT 非表示ユーザーを更新します
/// </summary>
/// <exception cref="WebApiException"/>
- public void RefreshNoRetweetIds()
+ public async Task RefreshNoRetweetIds()
{
if (MyCommon._endingFlag) return;
- this.noRTId = this.NoRetweetIdsApi();
+ this.noRTId = await this.Api.NoRetweetIds()
+ .ConfigureAwait(false);
this._GetNoRetweetResult = true;
}
- private long[] NoRetweetIdsApi()
- {
- this.CheckAccountState();
-
- HttpStatusCode res;
- var content = "";
- try
- {
- res = twCon.NoRetweetIds(ref content);
- }
- catch(Exception e)
- {
- throw new WebApiException("Err:" + e.Message + "(" + MethodBase.GetCurrentMethod().Name + ")", e);
- }
-
- this.CheckStatusCode(res, content);
-
- try
- {
- return MyCommon.CreateDataFromJson<long[]>(content);
- }
- catch(SerializationException e)
- {
- var ex = new WebApiException("Err:Json Parse Error(DataContractJsonSerializer)", content, e);
- MyCommon.TraceOut(ex);
- throw ex;
- }
- catch(Exception e)
- {
- var ex = new WebApiException("Err:Invalid Json!", content, e);
- MyCommon.TraceOut(ex);
- throw ex;
- }
- }
-
public bool GetNoRetweetSuccess
{
get