Skip to content

Commit c33496e

Browse files
Automatically update Dotnet SDK
1 parent 75f2c5d commit c33496e

14 files changed

Lines changed: 101 additions & 13 deletions

src/TrophyApi.sln

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.0.31903.59
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrophyApi", "TrophyApi\TrophyApi.csproj", "{D541463E-4084-48D7-8062-12A08F3E6EF0}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrophyApi", "TrophyApi\TrophyApi.csproj", "{FE7A1BB4-9293-4155-910C-7CCA74719912}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrophyApi.Test", "TrophyApi.Test\TrophyApi.Test.csproj", "{02A7BBDE-D2F2-4A28-8717-BB58B8A47E40}"
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrophyApi.Test", "TrophyApi.Test\TrophyApi.Test.csproj", "{A5415215-EA4F-4EC5-9FD0-B928A846143F}"
99
EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -16,13 +16,13 @@ Global
1616
HideSolutionNode = FALSE
1717
EndGlobalSection
1818
GlobalSection(ProjectConfigurationPlatforms) = postSolution
19-
{D541463E-4084-48D7-8062-12A08F3E6EF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20-
{D541463E-4084-48D7-8062-12A08F3E6EF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
21-
{D541463E-4084-48D7-8062-12A08F3E6EF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
22-
{D541463E-4084-48D7-8062-12A08F3E6EF0}.Release|Any CPU.Build.0 = Release|Any CPU
23-
{02A7BBDE-D2F2-4A28-8717-BB58B8A47E40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24-
{02A7BBDE-D2F2-4A28-8717-BB58B8A47E40}.Debug|Any CPU.Build.0 = Debug|Any CPU
25-
{02A7BBDE-D2F2-4A28-8717-BB58B8A47E40}.Release|Any CPU.ActiveCfg = Release|Any CPU
26-
{02A7BBDE-D2F2-4A28-8717-BB58B8A47E40}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{FE7A1BB4-9293-4155-910C-7CCA74719912}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20+
{FE7A1BB4-9293-4155-910C-7CCA74719912}.Debug|Any CPU.Build.0 = Debug|Any CPU
21+
{FE7A1BB4-9293-4155-910C-7CCA74719912}.Release|Any CPU.ActiveCfg = Release|Any CPU
22+
{FE7A1BB4-9293-4155-910C-7CCA74719912}.Release|Any CPU.Build.0 = Release|Any CPU
23+
{A5415215-EA4F-4EC5-9FD0-B928A846143F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24+
{A5415215-EA4F-4EC5-9FD0-B928A846143F}.Debug|Any CPU.Build.0 = Debug|Any CPU
25+
{A5415215-EA4F-4EC5-9FD0-B928A846143F}.Release|Any CPU.ActiveCfg = Release|Any CPU
26+
{A5415215-EA4F-4EC5-9FD0-B928A846143F}.Release|Any CPU.Build.0 = Release|Any CPU
2727
EndGlobalSection
2828
EndGlobal

src/TrophyApi/Achievements/AchievementsClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,29 @@ internal AchievementsClient(RawClient client)
1818
/// Get all achievements and their completion stats.
1919
/// </summary>
2020
/// <example><code>
21-
/// await client.Achievements.AllAsync();
21+
/// await client.Achievements.AllAsync(
22+
/// new AchievementsAllRequest { UserAttributes = "plan-type:premium,region:us-east" }
23+
/// );
2224
/// </code></example>
2325
public async Task<IEnumerable<AchievementWithStatsResponse>> AllAsync(
26+
AchievementsAllRequest request,
2427
RequestOptions? options = null,
2528
CancellationToken cancellationToken = default
2629
)
2730
{
31+
var _query = new Dictionary<string, object>();
32+
if (request.UserAttributes != null)
33+
{
34+
_query["userAttributes"] = request.UserAttributes;
35+
}
2836
var response = await _client
2937
.SendRequestAsync(
3038
new JsonRequest
3139
{
3240
BaseUrl = _client.Options.Environment.Api,
3341
Method = HttpMethod.Get,
3442
Path = "achievements",
43+
Query = _query,
3544
Options = options,
3645
},
3746
cancellationToken
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Text.Json.Serialization;
2+
using TrophyApi.Core;
3+
4+
namespace TrophyApi;
5+
6+
[Serializable]
7+
public record AchievementsAllRequest
8+
{
9+
/// <summary>
10+
/// Optional colon-delimited user attributes in the format attribute:value,attribute:value. Only achievements accessible to a user with the provided attributes will be returned.
11+
/// </summary>
12+
[JsonIgnore]
13+
public string? UserAttributes { get; set; }
14+
15+
/// <inheritdoc />
16+
public override string ToString()
17+
{
18+
return JsonUtils.Serialize(this);
19+
}
20+
}

src/TrophyApi/Leaderboards/LeaderboardsClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public async Task<IEnumerable<LeaderboardsAllResponseItem>> AllAsync(
9090
/// Limit = 1,
9191
/// Run = "2025-01-15",
9292
/// UserId = "user-123",
93+
/// UserAttributes = "city:London",
9394
/// }
9495
/// );
9596
/// </code></example>
@@ -117,6 +118,10 @@ public async Task<LeaderboardResponseWithRankings> GetAsync(
117118
{
118119
_query["userId"] = request.UserId;
119120
}
121+
if (request.UserAttributes != null)
122+
{
123+
_query["userAttributes"] = request.UserAttributes;
124+
}
120125
var response = await _client
121126
.SendRequestAsync(
122127
new JsonRequest

src/TrophyApi/Leaderboards/Requests/LeaderboardsGetRequest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ public record LeaderboardsGetRequest
3030
[JsonIgnore]
3131
public string? UserId { get; set; }
3232

33+
/// <summary>
34+
/// Attribute key and value to filter the rankings by, separated by a colon. This parameter is required, and only valid for leaderboards with a breakdown attribute.
35+
/// </summary>
36+
[JsonIgnore]
37+
public string? UserAttributes { get; set; }
38+
3339
/// <inheritdoc />
3440
public override string ToString()
3541
{

src/TrophyApi/Leaderboards/Types/LeaderboardsAllResponseItem.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ public record LeaderboardsAllResponseItem
3737
[JsonPropertyName("rankBy")]
3838
public required LeaderboardResponseRankBy RankBy { get; set; }
3939

40+
/// <summary>
41+
/// The key of the attribute to break down this leaderboard by.
42+
/// </summary>
43+
[JsonPropertyName("breakdownAttribute")]
44+
public string? BreakdownAttribute { get; set; }
45+
4046
/// <summary>
4147
/// The key of the metric to rank by, if rankBy is 'metric'.
4248
/// </summary>

src/TrophyApi/Points/Requests/PointsSummaryRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace TrophyApi;
77
public record PointsSummaryRequest
88
{
99
/// <summary>
10-
/// Optional colon-delimited user attribute filters in the format attributeKey:value,attributeKey:value. Only users matching ALL specified attributes will be included in the points breakdown.
10+
/// Optional colon-delimited user attribute filters in the format attribute:value,attribute:value. Only users matching ALL specified attributes will be included in the points breakdown.
1111
/// </summary>
1212
[JsonIgnore]
1313
public string? UserAttributes { get; set; }

src/TrophyApi/TrophyApi.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<!-- 🔹 NuGet Metadata -->
1111
<PackageId>Trophy</PackageId>
12-
<Version>1.0.30</Version>
12+
<Version>1.0.31</Version>
1313
<Authors>Trophy Labs, Inc</Authors>
1414
<Description>.NET SDK for the Trophy API</Description>
1515
<PackageTags>trophy; api; gamification; sdk</PackageTags>

src/TrophyApi/Types/LeaderboardResponse.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public record LeaderboardResponse
3434
[JsonPropertyName("rankBy")]
3535
public required LeaderboardResponseRankBy RankBy { get; set; }
3636

37+
/// <summary>
38+
/// The key of the attribute to break down this leaderboard by.
39+
/// </summary>
40+
[JsonPropertyName("breakdownAttribute")]
41+
public string? BreakdownAttribute { get; set; }
42+
3743
/// <summary>
3844
/// The key of the metric to rank by, if rankBy is 'metric'.
3945
/// </summary>

src/TrophyApi/Types/LeaderboardResponseWithRankings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public record LeaderboardResponseWithRankings
4343
[JsonPropertyName("rankBy")]
4444
public required LeaderboardResponseRankBy RankBy { get; set; }
4545

46+
/// <summary>
47+
/// The key of the attribute to break down this leaderboard by.
48+
/// </summary>
49+
[JsonPropertyName("breakdownAttribute")]
50+
public string? BreakdownAttribute { get; set; }
51+
4652
/// <summary>
4753
/// The key of the metric to rank by, if rankBy is 'metric'.
4854
/// </summary>

0 commit comments

Comments
 (0)