diff --git a/CHANGELOG.md b/CHANGELOG.md index 63bdb7798..c4e16a193 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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` diff --git a/Gw2Sharp.Tests/TestFiles/Account/AccountProgression.json b/Gw2Sharp.Tests/TestFiles/Account/AccountProgression.json new file mode 100644 index 000000000..3d7e1f916 --- /dev/null +++ b/Gw2Sharp.Tests/TestFiles/Account/AccountProgression.json @@ -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 + } +] diff --git a/Gw2Sharp.Tests/WebApi/V2/Clients/Account/AccountLuckClientTests.cs b/Gw2Sharp.Tests/WebApi/V2/Clients/Account/AccountLuckClientTests.cs index 294a2fe68..22775f12f 100644 --- a/Gw2Sharp.Tests/WebApi/V2/Clients/Account/AccountLuckClientTests.cs +++ b/Gw2Sharp.Tests/WebApi/V2/Clients/Account/AccountLuckClientTests.cs @@ -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 { protected override bool IsAuthenticated => true; diff --git a/Gw2Sharp.Tests/WebApi/V2/Clients/Account/AccountProgressionClientTests.cs b/Gw2Sharp.Tests/WebApi/V2/Clients/Account/AccountProgressionClientTests.cs new file mode 100644 index 000000000..0eb2882d3 --- /dev/null +++ b/Gw2Sharp.Tests/WebApi/V2/Clients/Account/AccountProgressionClientTests.cs @@ -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 + { + 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); + } +} diff --git a/Gw2Sharp/WebApi/V2/Clients/Account/AccountClient.cs b/Gw2Sharp/WebApi/V2/Clients/Account/AccountClient.cs index 056618f83..aa2750187 100644 --- a/Gw2Sharp/WebApi/V2/Clients/Account/AccountClient.cs +++ b/Gw2Sharp/WebApi/V2/Clients/Account/AccountClient.cs @@ -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; @@ -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; @@ -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); @@ -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); @@ -119,6 +125,7 @@ protected internal AccountClient(IConnection connection, IGw2Client gw2Client) : public virtual IAccountLegendaryArmoryClient LegendaryArmory => this.legendaryArmory; /// + [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; /// @@ -151,6 +158,9 @@ protected internal AccountClient(IConnection connection, IGw2Client gw2Client) : /// public virtual IAccountPvpClient Pvp => this.pvp; + /// + public virtual IAccountProgressionClient Progression => this.progression; + /// public virtual IAccountRaidsClient Raids => this.raids; diff --git a/Gw2Sharp/WebApi/V2/Clients/Account/AccountLuckClient.cs b/Gw2Sharp/WebApi/V2/Clients/Account/AccountLuckClient.cs index 4acc33826..b896b817a 100644 --- a/Gw2Sharp/WebApi/V2/Clients/Account/AccountLuckClient.cs +++ b/Gw2Sharp/WebApi/V2/Clients/Account/AccountLuckClient.cs @@ -8,6 +8,7 @@ namespace Gw2Sharp.WebApi.V2.Clients /// [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>, IAccountLuckClient { /// diff --git a/Gw2Sharp/WebApi/V2/Clients/Account/AccountProgressionClient.cs b/Gw2Sharp/WebApi/V2/Clients/Account/AccountProgressionClient.cs new file mode 100644 index 000000000..2d5d0673f --- /dev/null +++ b/Gw2Sharp/WebApi/V2/Clients/Account/AccountProgressionClient.cs @@ -0,0 +1,23 @@ +using System; +using Gw2Sharp.WebApi.V2.Models; + +namespace Gw2Sharp.WebApi.V2.Clients +{ + /// + /// A client of the Guild Wars 2 API v2 account progression endpoint. + /// + [EndpointPath("account/progression")] + [EndpointSchemaVersion("2021-09-28T00:00:00.000Z")] + public class AccountProgressionClient : BaseEndpointBlobClient>, IAccountProgressionClient + { + /// + /// Creates a new that is used for the API v2 account progression endpoint. + /// + /// The connection used to make requests, see . + /// The Guild Wars 2 client. + /// or is null. + protected internal AccountProgressionClient(IConnection connection, IGw2Client gw2Client) : + base(connection, gw2Client) + { } + } +} diff --git a/Gw2Sharp/WebApi/V2/Clients/Account/IAccountClient.cs b/Gw2Sharp/WebApi/V2/Clients/Account/IAccountClient.cs index 2dac934b0..a45dda1f2 100644 --- a/Gw2Sharp/WebApi/V2/Clients/Account/IAccountClient.cs +++ b/Gw2Sharp/WebApi/V2/Clients/Account/IAccountClient.cs @@ -1,3 +1,4 @@ +using System; using Gw2Sharp.WebApi.V2.Models; namespace Gw2Sharp.WebApi.V2.Clients @@ -89,6 +90,7 @@ public interface IAccountClient : /// Gets the luck progression. /// Requires scores: account, progression, unlocks. /// + [Obsolete("Deprecated since 2021-09-28. Use Account.Progression instead. This will be removed from Gw2Sharp starting from version 2.0.")] IAccountLuckClient Luck { get; } /// @@ -148,6 +150,12 @@ public interface IAccountClient : /// IAccountOutfitsClient Outfits { get; } + /// + /// Gets the progression. + /// Requires scopes: account, progression. + /// + IAccountProgressionClient Progression { get; } + /// /// Gets the PvP. /// diff --git a/Gw2Sharp/WebApi/V2/Clients/Account/IAccountLuckClient.cs b/Gw2Sharp/WebApi/V2/Clients/Account/IAccountLuckClient.cs index 22c296d1f..607da248d 100644 --- a/Gw2Sharp/WebApi/V2/Clients/Account/IAccountLuckClient.cs +++ b/Gw2Sharp/WebApi/V2/Clients/Account/IAccountLuckClient.cs @@ -1,3 +1,4 @@ +using System; using Gw2Sharp.WebApi.V2.Models; namespace Gw2Sharp.WebApi.V2.Clients @@ -5,6 +6,7 @@ namespace Gw2Sharp.WebApi.V2.Clients /// /// A client of the Guild Wars 2 API v2 account luck endpoint. /// + [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> diff --git a/Gw2Sharp/WebApi/V2/Clients/Account/IAccountProgressionClient.cs b/Gw2Sharp/WebApi/V2/Clients/Account/IAccountProgressionClient.cs new file mode 100644 index 000000000..0ebffa339 --- /dev/null +++ b/Gw2Sharp/WebApi/V2/Clients/Account/IAccountProgressionClient.cs @@ -0,0 +1,13 @@ +using Gw2Sharp.WebApi.V2.Models; + +namespace Gw2Sharp.WebApi.V2.Clients +{ + /// + /// A client of the Guild Wars 2 API v2 account progression endpoint. + /// + public interface IAccountProgressionClient : + IAuthenticatedClient, + IBlobClient> + { + } +} diff --git a/Gw2Sharp/WebApi/V2/Models/Account/AccountLuck.cs b/Gw2Sharp/WebApi/V2/Models/Account/AccountLuck.cs index 3f2cb017c..93f357174 100644 --- a/Gw2Sharp/WebApi/V2/Models/Account/AccountLuck.cs +++ b/Gw2Sharp/WebApi/V2/Models/Account/AccountLuck.cs @@ -1,8 +1,11 @@ +using System; + namespace Gw2Sharp.WebApi.V2.Models { /// /// Represents an account luck. /// + [Obsolete("Deprecated since 2021-09-28. Use Account.Progression instead. This will be removed from Gw2Sharp starting from version 2.0.")] public class AccountLuck { /// diff --git a/Gw2Sharp/WebApi/V2/Models/Account/AccountProgression.cs b/Gw2Sharp/WebApi/V2/Models/Account/AccountProgression.cs new file mode 100644 index 000000000..ba33290b9 --- /dev/null +++ b/Gw2Sharp/WebApi/V2/Models/Account/AccountProgression.cs @@ -0,0 +1,18 @@ +namespace Gw2Sharp.WebApi.V2.Models +{ + /// + /// Represents an account progression. + /// + public class AccountProgression + { + /// + /// The progression id. + /// + public string Id { get; set; } = string.Empty; + + /// + /// The progression value. + /// + public int Value { get; set; } + } +} diff --git a/docs/guides/endpoints.md b/docs/guides/endpoints.md index 244178fe8..6a7a7800b 100644 --- a/docs/guides/endpoints.md +++ b/docs/guides/endpoints.md @@ -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
➡️ /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) @@ -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) @@ -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~~ | ✖️ |