Skip to content
This repository has been archived by the owner on May 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1 from semihokur/master
Browse files Browse the repository at this point in the history
Improved async/await usage
  • Loading branch information
jarvisji committed Sep 10, 2013
2 parents 221c3db + 55c45f4 commit 21e3775
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions kanboxwp/kanboxwp/Utils/KBApiUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ public static string ParseAuthCodeFromUrl(string url)
/// <param name="path"></param>
/// <param name="token"></param>
/// <returns></returns>
public static async Task<KbListInfo> GetFileListAsync(string path, KbToken token)
public static Task<KbListInfo> GetFileListAsync(string path, KbToken token)
{
return await GetFileListAsync(path, token, null);
return GetFileListAsync(path, token, null);
}

/// <summary>
Expand All @@ -179,7 +179,7 @@ public static async Task<KbListInfo> GetFileListAsync(string path, KbToken token
url += "?hash=" + hashcode;
}
string received = await doGetAsync(url, GetAuthorizationHeader(token));
KbListInfo listInfo = JsonConvert.DeserializeObject<KbListInfo>(received);
KbListInfo listInfo = await JsonConvert.DeserializeObjectAsync<KbListInfo>(received);
return listInfo;
}

Expand All @@ -191,7 +191,7 @@ public static async Task<KbListInfo> GetFileListAsync(string path, KbToken token
public static async Task<KbAccountInfo> GetAccountInfo(KbToken token)
{
string received = await doGetAsync(InfoUrl, GetAuthorizationHeader(token));
KbAccountInfo accountInfo = JsonConvert.DeserializeObject<KbAccountInfo>(received);
KbAccountInfo accountInfo = await JsonConvert.DeserializeObjectAsync<KbAccountInfo>(received);
return accountInfo;
}

Expand Down Expand Up @@ -232,7 +232,7 @@ public static async Task<KbToken> GetTokenAsync(string authcode)
redirect_uri = HttpUtility.UrlEncode(KB_REDIRECTURL_KANBOXWP_DUMMYPAGE)
});
string received = await doPostAsync(TokenUrl, postdata);
KbToken token = JsonConvert.DeserializeObject<KbToken>(received);
KbToken token = await JsonConvert.DeserializeObjectAsync<KbToken>(received);
UpdateExpiresTime(token);
return token;
}
Expand All @@ -252,7 +252,7 @@ public static async Task<KbToken> RefreshTokenAsync(string refreshToken)
refresh_token = HttpUtility.UrlEncode(refreshToken)
});
string received = await doPostAsync(TokenUrl, data);
KbToken token = JsonConvert.DeserializeObject<KbToken>(received);
KbToken token = await JsonConvert.DeserializeObjectAsync<KbToken>(received);
UpdateExpiresTime(token);
return token;
}
Expand Down Expand Up @@ -286,9 +286,9 @@ private static async Task<string> doPostAsync(string url, string postdata)
return received;
}

private static async Task<string> doGetAsync(string url)
private static Task<string> doGetAsync(string url)
{
return await doGetAsync(url, null);
return doGetAsync(url, null);
}

private static async Task<string> doGetAsync(string url, Dictionary<string, string> headers)
Expand Down

0 comments on commit 21e3775

Please sign in to comment.