Skip to content

Commit

Permalink
Add /v2/account/progression and deprecate /v2/account/luck
Browse files Browse the repository at this point in the history
  • Loading branch information
Archomeda committed Sep 28, 2021
1 parent 4d7385f commit 2cb7dc1
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 4 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Gw2Sharp History

## 1.4.0 (28 September 2021)
This release focuses on the new account progression addition, introduced on 28 September 2021.

### Endpoints
- Add `/v2/account/progression` ([#101](https://github.com/Archomeda/Gw2Sharp/issues/101), [#103](https://github.com/Archomeda/Gw2Sharp/pull/103))
- Mark `/v2/account/luck` as deprecated (progression is the replacement) ([#102](https://github.com/Archomeda/Gw2Sharp/issues/102), [#103](https://github.com/Archomeda/Gw2Sharp/pull/103))

*Note: All deprecations in version 1.x will be removed in version 2.0. Make sure that you update the references.*

---

## 1.3.0 (4 September 2021)
This release includes a single addition to the WvW match endpoints, which is the ability to request a match by world id for the following endpoints:
- `/v2/wvw/matches`
Expand Down
18 changes: 18 additions & 0 deletions Gw2Sharp.Tests/TestFiles/Account/AccountProgression.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"id": "fractal_agony_impedance",
"value": 2
},
{
"id": "fractal_empowerment",
"value": 1
},
{
"id": "fractal_karmic_retribution",
"value": 3
},
{
"id": "luck",
"value": 1234000
}
]
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using System.Threading.Tasks;
using Gw2Sharp.WebApi.V2.Clients;
using Xunit;

namespace Gw2Sharp.Tests.WebApi.V2.Clients
{
[Obsolete("Deprecated since 2021-09-28. This will be removed from Gw2Sharp starting from version 2.0.")]
public class AccountLuckClientTests : BaseEndpointClientTests<IAccountLuckClient>
{
protected override bool IsAuthenticated => true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Threading.Tasks;
using Gw2Sharp.WebApi.V2.Clients;
using Xunit;

namespace Gw2Sharp.Tests.WebApi.V2.Clients
{
public class AccountProgressionClientTests : BaseEndpointClientTests<IAccountProgressionClient>
{
protected override bool IsAuthenticated => true;

protected override IAccountProgressionClient CreateClient(IGw2Client gw2Client) =>
gw2Client.WebApi.V2.Account.Progression;

[Theory]
[InlineData("TestFiles.Account.AccountProgression.json")]
public Task BlobTest(string file) => this.AssertBlobDataAsync(this.Client, file);
}
}
10 changes: 10 additions & 0 deletions Gw2Sharp/WebApi/V2/Clients/Account/AccountClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public class AccountClient : BaseEndpointClient, IAccountClient
private readonly IAccountHomeClient home;
private readonly IAccountInventoryClient inventory;
private readonly IAccountLegendaryArmoryClient legendaryArmory;
#pragma warning disable CS0618 // Type or member is obsolete
private readonly IAccountLuckClient luck;
#pragma warning restore CS0618 // Type or member is obsolete
private readonly IAccountMailCarriersClient mailCarriers;
private readonly IAccountMapChestsClient mapChests;
private readonly IAccountMasteriesClient masteries;
Expand All @@ -34,6 +36,7 @@ public class AccountClient : BaseEndpointClient, IAccountClient
private readonly IAccountMountsClient mounts;
private readonly IAccountNoveltiesClient novelties;
private readonly IAccountOutfitsClient outfits;
private readonly IAccountProgressionClient progression;
private readonly IAccountPvpClient pvp;
private readonly IAccountRaidsClient raids;
private readonly IAccountRecipesClient recipes;
Expand Down Expand Up @@ -63,7 +66,9 @@ protected internal AccountClient(IConnection connection, IGw2Client gw2Client) :
this.home = new AccountHomeClient(connection, gw2Client);
this.inventory = new AccountInventoryClient(connection, gw2Client);
this.legendaryArmory = new AccountLegendaryArmoryClient(connection, gw2Client);
#pragma warning disable CS0618 // Type or member is obsolete
this.luck = new AccountLuckClient(connection, gw2Client);
#pragma warning restore CS0618 // Type or member is obsolete
this.mailCarriers = new AccountMailCarriersClient(connection, gw2Client);
this.mapChests = new AccountMapChestsClient(connection, gw2Client);
this.masteries = new AccountMasteriesClient(connection, gw2Client);
Expand All @@ -73,6 +78,7 @@ protected internal AccountClient(IConnection connection, IGw2Client gw2Client) :
this.mounts = new AccountMountsClient(connection, gw2Client);
this.novelties = new AccountNoveltiesClient(connection, gw2Client);
this.outfits = new AccountOutfitsClient(connection, gw2Client);
this.progression = new AccountProgressionClient(connection, gw2Client);
this.pvp = new AccountPvpClient(connection, gw2Client);
this.raids = new AccountRaidsClient(connection, gw2Client);
this.recipes = new AccountRecipesClient(connection, gw2Client);
Expand Down Expand Up @@ -119,6 +125,7 @@ protected internal AccountClient(IConnection connection, IGw2Client gw2Client) :
public virtual IAccountLegendaryArmoryClient LegendaryArmory => this.legendaryArmory;

/// <inheritdoc />
[Obsolete("Deprecated since 2021-09-28. Use Account.Progression instead. This will be removed from Gw2Sharp starting from version 2.0.")]
public virtual IAccountLuckClient Luck => this.luck;

/// <inheritdoc />
Expand Down Expand Up @@ -151,6 +158,9 @@ protected internal AccountClient(IConnection connection, IGw2Client gw2Client) :
/// <inheritdoc />
public virtual IAccountPvpClient Pvp => this.pvp;

/// <inheritdoc />
public virtual IAccountProgressionClient Progression => this.progression;

/// <inheritdoc />
public virtual IAccountRaidsClient Raids => this.raids;

Expand Down
1 change: 1 addition & 0 deletions Gw2Sharp/WebApi/V2/Clients/Account/AccountLuckClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Gw2Sharp.WebApi.V2.Clients
/// </summary>
[EndpointPath("account/luck")]
[EndpointSchemaVersion("2019-02-21T00:00:00.000Z")]
[Obsolete("Deprecated since 2021-09-28. Use Account.Progression instead. This will be removed from Gw2Sharp starting from version 2.0.")]
public class AccountLuckClient : BaseEndpointBlobClient<IApiV2ObjectList<AccountLuck>>, IAccountLuckClient
{
/// <summary>
Expand Down
23 changes: 23 additions & 0 deletions Gw2Sharp/WebApi/V2/Clients/Account/AccountProgressionClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using Gw2Sharp.WebApi.V2.Models;

namespace Gw2Sharp.WebApi.V2.Clients
{
/// <summary>
/// A client of the Guild Wars 2 API v2 account progression endpoint.
/// </summary>
[EndpointPath("account/progression")]
[EndpointSchemaVersion("2021-09-28T00:00:00.000Z")]
public class AccountProgressionClient : BaseEndpointBlobClient<IApiV2ObjectList<AccountProgression>>, IAccountProgressionClient
{
/// <summary>
/// Creates a new <see cref="AccountProgressionClient"/> that is used for the API v2 account progression endpoint.
/// </summary>
/// <param name="connection">The connection used to make requests, see <see cref="IConnection"/>.</param>
/// <param name="gw2Client">The Guild Wars 2 client.</param>
/// <exception cref="ArgumentNullException"><paramref name="connection"/> or <paramref name="gw2Client"/> is <c>null</c>.</exception>
protected internal AccountProgressionClient(IConnection connection, IGw2Client gw2Client) :
base(connection, gw2Client)
{ }
}
}
8 changes: 8 additions & 0 deletions Gw2Sharp/WebApi/V2/Clients/Account/IAccountClient.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using Gw2Sharp.WebApi.V2.Models;

namespace Gw2Sharp.WebApi.V2.Clients
Expand Down Expand Up @@ -89,6 +90,7 @@ public interface IAccountClient :
/// Gets the luck progression.
/// Requires scores: account, progression, unlocks.
/// </summary>
[Obsolete("Deprecated since 2021-09-28. Use Account.Progression instead. This will be removed from Gw2Sharp starting from version 2.0.")]
IAccountLuckClient Luck { get; }

/// <summary>
Expand Down Expand Up @@ -148,6 +150,12 @@ public interface IAccountClient :
/// </summary>
IAccountOutfitsClient Outfits { get; }

/// <summary>
/// Gets the progression.
/// Requires scopes: account, progression.
/// </summary>
IAccountProgressionClient Progression { get; }

/// <summary>
/// Gets the PvP.
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions Gw2Sharp/WebApi/V2/Clients/Account/IAccountLuckClient.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System;
using Gw2Sharp.WebApi.V2.Models;

namespace Gw2Sharp.WebApi.V2.Clients
{
/// <summary>
/// A client of the Guild Wars 2 API v2 account luck endpoint.
/// </summary>
[Obsolete("Deprecated since 2021-09-28. Use Account.Progression instead. This will be removed from Gw2Sharp starting from version 2.0.")]
public interface IAccountLuckClient :
IAuthenticatedClient,
IBlobClient<IApiV2ObjectList<AccountLuck>>
Expand Down
13 changes: 13 additions & 0 deletions Gw2Sharp/WebApi/V2/Clients/Account/IAccountProgressionClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Gw2Sharp.WebApi.V2.Models;

namespace Gw2Sharp.WebApi.V2.Clients
{
/// <summary>
/// A client of the Guild Wars 2 API v2 account progression endpoint.
/// </summary>
public interface IAccountProgressionClient :
IAuthenticatedClient,
IBlobClient<IApiV2ObjectList<AccountProgression>>
{
}
}
3 changes: 3 additions & 0 deletions Gw2Sharp/WebApi/V2/Models/Account/AccountLuck.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using System;

namespace Gw2Sharp.WebApi.V2.Models
{
/// <summary>
/// Represents an account luck.
/// </summary>
[Obsolete("Deprecated since 2021-09-28. Use Account.Progression instead. This will be removed from Gw2Sharp starting from version 2.0.")]
public class AccountLuck
{
/// <summary>
Expand Down
18 changes: 18 additions & 0 deletions Gw2Sharp/WebApi/V2/Models/Account/AccountProgression.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Gw2Sharp.WebApi.V2.Models
{
/// <summary>
/// Represents an account progression.
/// </summary>
public class AccountProgression
{
/// <summary>
/// The progression id.
/// </summary>
public string Id { get; set; } = string.Empty;

/// <summary>
/// The progression value.
/// </summary>
public int Value { get; set; }
}
}
9 changes: 5 additions & 4 deletions docs/guides/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ For your convenience, the following list gives an overview of the web API endpoi
/v2/account/home/nodes | 🔑 | [`Gw2Client.WebApi.V2.Account.Home.Nodes`](../api/Gw2Sharp.WebApi.V2.Clients.AccountHomeNodesClient.html)
/v2/account/inventory | 🔑📆 | [`Gw2Client.WebApi.V2.Account.Inventory`](../api/Gw2Sharp.WebApi.V2.Clients.AccountInventoryClient.html)
/v2/account/legendaryarmory | 🔑 | [`Gw2Client.WebApi.V2.Account.LegendaryArmory`](../api/Gw2Sharp.WebApi.V2.Clients.AccountLegendaryArmoryClient.html)
/v2/account/luck | 🔑 | [`Gw2Client.WebApi.V2.Account.Luck`](../api/Gw2Sharp.WebApi.V2.Clients.AccountLuckClient.html)
/v2/account/luck<br>➡️ /v2/account/progression | 🔑⚠️ | [`Gw2Client.WebApi.V2.Account.Luck`](../api/Gw2Sharp.WebApi.V2.Clients.AccountLuckClient.html)
~~/v2/account/mail~~ | ✖️ |
/v2/account/mailcarriers | 🔑 | [`Gw2Client.WebApi.V2.Account.MailCarriers`](../api/Gw2Sharp.WebApi.V2.Clients.AccountMailCarriersClient.html)
/v2/account/mapchests | 🔑 | [`Gw2Client.WebApi.V2.Account.MapChests`](../api/Gw2Sharp.WebApi.V2.Clients.AccountMapChestsClient.html)
Expand All @@ -49,6 +49,7 @@ For your convenience, the following list gives an overview of the web API endpoi
/v2/account/mounts/types | 🔑 | [`Gw2Client.WebApi.V2.Account.Mounts.Types`](../api/Gw2Sharp.WebApi.V2.Clients.AccountMountsTypesClient.html)
/v2/account/novelties | 🔑 | [`Gw2Client.WebApi.V2.Account.Novelties.Types`](../api/Gw2Sharp.WebApi.V2.Clients.AccountNoveltiesClient.html)
/v2/account/outfits | 🔑📆 | [`Gw2Client.WebApi.V2.Account.Outfits`](../api/Gw2Sharp.WebApi.V2.Clients.AccountOutfitsClient.html)
/v2/account/progression | 🔑 | [`Gw2Client.WebApi.V2.Account.Progression`](../api/Gw2Sharp.WebApi.V2.Clients.AccountProgressionClient.html)
/v2/account/pvp/heroes | 🔑 | [`Gw2Client.WebApi.V2.Account.Pvp.Heroes`](../api/Gw2Sharp.WebApi.V2.Clients.AccountPvpHeroesClient.html)
/v2/account/raids | 🔑 | [`Gw2Client.WebApi.V2.Account.Raids`](../api/Gw2Sharp.WebApi.V2.Clients.AccountRaidsClient.html)
/v2/account/recipes | 🔑📆 | [`Gw2Client.WebApi.V2.Account.Recipes`](../api/Gw2Sharp.WebApi.V2.Clients.AccountRecipesClient.html)
Expand Down Expand Up @@ -185,9 +186,9 @@ For your convenience, the following list gives an overview of the web API endpoi
/v2/wvw/matches/overview | 📄📚📦 | [`Gw2Client.WebApi.V2.Wvw.Matches.Overview`](../api/Gw2Sharp.WebApi.V2.Clients.WvwMatchesOverviewClient.html)
/v2/wvw/matches/scores | 📄📚📦 | [`Gw2Client.WebApi.V2.Wvw.Matches.Scores`](../api/Gw2Sharp.WebApi.V2.Clients.WvwMatchesScoresClient.html)
/v2/wvw/matches/stats | 📄📚📦 | [`Gw2Client.WebApi.V2.Wvw.Matches.Stats`](../api/Gw2Sharp.WebApi.V2.Clients.WvwMatchesStatsClient.html)
~~/v2/wvw/matches/stats/`:id`/guilds/`:guild_id`~~ | ✖️ | *Broken on the API as of 2012-12-22*
~~/v2/wvw/matches/stats/`:id`/teams/`:team`/top/kdr~~ | ✖️ | *Broken on the API as of 2012-12-22*
~~/v2/wvw/matches/stats/`:id`/teams/`:team`/top/kills~~ | ✖️ | *Broken on the API as of 2012-12-22*
~~/v2/wvw/matches/stats/`:id`/guilds/`:guild_id`~~ | ✖️ | *Broken on the API as of 2020-12-22*
~~/v2/wvw/matches/stats/`:id`/teams/`:team`/top/kdr~~ | ✖️ | *Broken on the API as of 2020-12-22*
~~/v2/wvw/matches/stats/`:id`/teams/`:team`/top/kills~~ | ✖️ | *Broken on the API as of 2020-12-22*
/v2/wvw/objectives | 🌐📄📚📦 | [`Gw2Client.WebApi.V2.Wvw.Objectives`](../api/Gw2Sharp.WebApi.V2.Clients.WvwObjectivesClient.html)
/v2/wvw/ranks | 🌐📄📚📦 | [`Gw2Client.WebApi.V2.Wvw.Ranks`](../api/Gw2Sharp.WebApi.V2.Clients.WvwRanksClient.html)
~~/v2/wvw/rewardtracks~~ | ✖️ |
Expand Down

0 comments on commit 2cb7dc1

Please sign in to comment.