Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #322 from aspriddell/update-gettoken-signature
Browse files Browse the repository at this point in the history
change method signature to accept a sessionid and a task over valuetask
  • Loading branch information
aspriddell authored Aug 1, 2022
2 parents 050c575 + 0bcaeb8 commit 43a8820
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions DragonFruit.Six.Api/Dragon6Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ static Dragon6Client()
/// <summary>
/// Defines the procedure for retrieving a <see cref="UbisoftToken"/> for the client to use.
/// </summary>
/// <param name="sessionId">The last recorded session id. This should be used to check if a new session should be created from the server</param>
/// <remarks>
/// It is recommended to store the token to a file and try to retrieve from there before resorting to the online systems, as accounts can be blocked due to rate-limits
/// </remarks>
protected abstract ValueTask<IUbisoftToken> GetToken();
protected abstract Task<IUbisoftToken> GetToken(string sessionId);

/// <summary>
/// Updates the Ubi-AppId header to be supplied to each request.
Expand Down Expand Up @@ -77,7 +78,7 @@ protected internal async ValueTask<ClientAccessToken> RequestAccessToken()
// check again in case of a backlog
if (_access?.Expired is not false)
{
var token = await GetToken().ConfigureAwait(false);
var token = await GetToken(_access?.Token.SessionId).ConfigureAwait(false);
_access = new ClientAccessToken(token);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public Dragon6DeveloperClient(string clientId, string clientSecret, string scope
_scopes = scopes;
}

protected override async ValueTask<IUbisoftToken> GetToken()
protected override async Task<IUbisoftToken> GetToken(string sessionId)
{
return await PerformAsync<Dragon6Token>(new Dragon6TokenRequest()).ConfigureAwait(false);
}
Expand Down

0 comments on commit 43a8820

Please sign in to comment.