public static Task <OAuthToken> AuthenticateByCookieAsync(this IBattleNetClient battleNetClient, string clientId, string cookies, Uri redirectUrl)
        {
            var encodedUrlRedirect = HttpUtility.UrlEncode(redirectUrl.ToString());

            return(battleNetClient.QueryBattleNetApiAsync <OAuthToken>(HttpMethod.Get, $"/oauth/authorize?access_type=online&client_id={clientId}&redirect_uri={encodedUrlRedirect}&response_type=code&state=", null, cookies, null));
        }
 public static Task <OAuthToken> AuthenticateByClientCredentialsAsync(this IBattleNetClient battleNetClient)
 {
     return(battleNetClient.QueryBattleNetApiAsync <OAuthToken>(HttpMethod.Post, "/oauth/token", "grant_type=client_credentials&scope=openid wow.profile d3.profile sc2.profile", null, null));
 }
 public static Task <OAuthToken> AuthenticateByUserCredentialsAsync(this IBattleNetClient battleNetClient, string clientId, string secret, string code, Uri redirectUrl)
 {
     return(battleNetClient.QueryBattleNetApiAsync <OAuthToken>(HttpMethod.Post, "/oauth/token", $"code={code}&client_id={clientId}&client_secret={secret}&redirect_uri={redirectUrl}&grant_type=authorization_code&scope=openid wow.profile d3.profile sc2.profile", null, null));
 }
Esempio n. 4
0
 public Program(IBattleNetClient battlenetClient, ILogger <Program> logger)
 {
     this.battlenetClient = battlenetClient;
     this.logger          = logger;
 }
 public static Task <User> GetUser(this IBattleNetClient battleNetClient, OAuthToken authToken)
 {
     return(battleNetClient.QueryBattleNetApiAsync <User>(HttpMethod.Get, "/oauth/userinfo", null, null, authToken));
 }
Esempio n. 6
0
 public static Task <Season> GetSeasonAsync(this IBattleNetClient battleNetClient, int regionId, OAuthToken authToken)
 {
     return(battleNetClient.QueryBlizzardApiAsync <Season>($"/sc2/ladder/season/{regionId}", authToken));
 }
 public WarcraftClient(IBattleNetClient client)
 {
     if (client == null) throw new ArgumentNullException(nameof(client));
     _client = client;
 }
Esempio n. 8
0
 public static Task <LegacyRewardsRoot> GetLegacyRewards(this IBattleNetClient battleNetClient, int regionId, OAuthToken authToken)
 {
     return(battleNetClient.QueryBlizzardApiAsync <LegacyRewardsRoot>($"/sc2/legacy/data/rewards/{regionId}", authToken));
 }
Esempio n. 9
0
 public static Task <ProfileLegacyRoot> GetLegacyProfile(this IBattleNetClient battleNetClient, int regionId, int realmId, long profileId, OAuthToken authToken)
 {
     return(battleNetClient.QueryBlizzardApiAsync <ProfileLegacyRoot>($"/sc2/legacy/profile/{regionId}/{realmId}/{profileId}", authToken));
 }
Esempio n. 10
0
 public static Task <LadderRoot> GetLadder(this IBattleNetClient battleNetClient, int regionId, int realmId, long profileId, long ladderId, OAuthToken authToken)
 {
     return(battleNetClient.QueryBlizzardApiAsync <LadderRoot>($"/sc2/profile/{regionId}/{realmId}/{profileId}/ladder/{ladderId}", authToken));
 }
Esempio n. 11
0
 public static Task <AchievementsRoot> GetLegacyAchievementsAsync(this IBattleNetClient battleNetClient, int regionId, OAuthToken authToken)
 {
     return(battleNetClient.QueryBlizzardApiAsync <AchievementsRoot>($"/sc2/legacy/data/achievements/{regionId}", authToken));
 }
Esempio n. 12
0
 public static Task <StaticRoot> GetStatic(this IBattleNetClient battleNetClient, int regionId, OAuthToken authToken)
 {
     return(battleNetClient.QueryBlizzardApiAsync <StaticRoot>($"/sc2/static/profile/{regionId}", authToken));
 }
Esempio n. 13
0
 public static Task <Player> GetPlayer(this IBattleNetClient battleNetClient, int regionId, int realmId, long profileId, OAuthToken authToken)
 {
     return(battleNetClient.QueryBlizzardApiAsync <Player>($"/sc2/metadata/profile/{regionId}/{realmId}/{profileId}", authToken));
 }
Esempio n. 14
0
 public static Task <IList <Player> > GetPlayers(this IBattleNetClient battleNetClient, ulong accountId, OAuthToken authToken)
 {
     return(battleNetClient.QueryBlizzardApiAsync <IList <Player> >($"/sc2/player/{accountId}", authToken));
 }
        public static async Task <OAuthToken> AuthenticateByAccessTokenAsync(this IBattleNetClient battleNetClient, string accessToken)
        {
            var tokenMetadata = await battleNetClient.VerifyTokenAsync(accessToken).ConfigureAwait(false);

            return(new OAuthToken(accessToken, "Bearer", tokenMetadata.Expiration, null, null));
        }
Esempio n. 16
0
 public static Task <LadderLegacyRoot> GetLegacyLadder(this IBattleNetClient battleNetClient, int regionId, long ladderId, OAuthToken authToken)
 {
     return(battleNetClient.QueryBlizzardApiAsync <LadderLegacyRoot>($"/sc2/legacy/ladder/{regionId}/{ladderId}", authToken));
 }
 public static Task <OAuthTokenMetadata> VerifyTokenAsync(this IBattleNetClient battleNetClient, string accessToken)
 {
     return(battleNetClient.QueryBattleNetApiAsync <OAuthTokenMetadata>(HttpMethod.Post, "/oauth/check_token", $"token={accessToken}", null, null));
 }
Esempio n. 18
0
 public static Task <GrandmasterLeaderboardRoot> GetGrandmasterLeaderBoardAsync(this IBattleNetClient battleNetClient, int regionId, OAuthToken authToken)
 {
     return(battleNetClient.QueryBlizzardApiAsync <GrandmasterLeaderboardRoot>($"/sc2/ladder/grandmaster/{regionId}", authToken));
 }