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 #237 from aspriddell/accountinfo-renames
Browse files Browse the repository at this point in the history
naming cleanups
  • Loading branch information
aspriddell authored Jun 12, 2021
2 parents f1d8e47 + d7fbe8c commit 1499924
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DragonFruit.Six.Api.Tests/Data/AccountActivityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void TestAccountActivity(string id, Platform platform, int lastLogin)
}

var account = GetAccountInfoFor(id, platform);
var login = Client.GetLoginInfo(account);
var login = Client.GetAccountActivity(account);

Assert.IsTrue(login.Activity.Last.UtcDateTime.Date > lastLoginDate.Date);
}
Expand Down
2 changes: 1 addition & 1 deletion DragonFruit.Six.Api.Tests/Utils/IpInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class IpInfoTests : Dragon6ApiTest
[Test]
public void TestIpInformation()
{
Client.GetUserLocationInfo();
Client.GeolocateSelf();
}
}
}
6 changes: 3 additions & 3 deletions DragonFruit.Six.Api/Extensions/AccountActivityExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ public static class AccountActivityExtensions
/// <summary>
/// Get the <see cref="AccountActivity"/> for a specific <see cref="AccountInfo"/>
/// </summary>
public static AccountActivity GetLoginInfo<T>(this T client, AccountInfo account, CancellationToken token = default) where T : Dragon6Client
=> GetLoginInfo(client, account.Yield(), token).For(account);
public static AccountActivity GetAccountActivity<T>(this T client, AccountInfo account, CancellationToken token = default) where T : Dragon6Client
=> GetAccountActivity(client, account.Yield(), token).For(account);

/// <summary>
/// Get the <see cref="AccountActivity"/> for an array of <see cref="AccountInfo"/>s
/// </summary>
public static ILookup<string, AccountActivity> GetLoginInfo<T>(this T client, IEnumerable<AccountInfo> accounts, CancellationToken token = default) where T : Dragon6Client
public static ILookup<string, AccountActivity> GetAccountActivity<T>(this T client, IEnumerable<AccountInfo> accounts, CancellationToken token = default) where T : Dragon6Client
{
var data = client.Perform<JObject>(new AccountActivityRequest(accounts), token);
return data.DeserializeAccountLoginInfo();
Expand Down
4 changes: 2 additions & 2 deletions DragonFruit.Six.Api/Extensions/UserLocationInfoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public static class UserLocationInfoExtensions
/// <summary>
/// Get the user's IP address and info from the ubisoft servers
/// </summary>
public static UserLocationInfo GetUserLocationInfo<T>(this T client, CancellationToken token = default) where T : Dragon6Client
public static UserLocationInfo GeolocateSelf<T>(this T client, CancellationToken token = default) where T : Dragon6Client
{
var request = new UserLocationInfoRequest();
var request = new GeolocationRequest();
return client.Perform<UserLocationInfo>(request, token);
}
}
Expand Down
7 changes: 6 additions & 1 deletion DragonFruit.Six.Api/Requests/AccountActivityRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ public AccountActivityRequest(IEnumerable<AccountInfo> profiles)
[QueryParameter("applicationIds", CollectionConversionMode.Concatenated)]
public IEnumerable<string> AppIds { get; set; }

/// <summary>
/// A <see cref="IEnumerable{T}"/> of profile ids to use. If set, this will ignore the <see cref="Accounts"/> property
/// </summary>
public IEnumerable<string> Profiles { get; set; }

/// <summary>
/// The accounts to check against the activity logs for <see cref="AppIds"/>
/// </summary>
public IEnumerable<AccountInfo> Accounts { get; set; }

[QueryParameter("profileIds", CollectionConversionMode.Concatenated)]
private IEnumerable<string> ProfileIdString => Accounts.Select(x => x.Identifiers.Profile);
private IEnumerable<string> ProfileIdString => Profiles ?? Accounts.Select(x => x.Identifiers.Profile);
}
}
5 changes: 1 addition & 4 deletions DragonFruit.Six.Api/Requests/AccountInfoRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ public AccountInfoRequest()
}

public AccountInfoRequest(Platform platform, LookupMethod lookupMethod, string query)
: this(platform, lookupMethod, query.Yield())
{
Platform = platform;
LookupMethod = lookupMethod;

LookupQuery = new[] { query };
}

public AccountInfoRequest(Platform platform, LookupMethod lookupMethod, IEnumerable<string> queries)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace DragonFruit.Six.Api.Requests
{
public class UserLocationInfoRequest : ApiRequest
public class GeolocationRequest : ApiRequest
{
public override string Path => $"{Endpoints.BaseEndpoint}/v2/profiles/me/iplocation";
}
Expand Down

0 comments on commit 1499924

Please sign in to comment.