Skip to content

Commit

Permalink
Add rich presence test and add JsonPropertyName attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
sudokoko committed Sep 27, 2023
1 parent 54f1e10 commit 1d57cc0
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 9 deletions.
22 changes: 22 additions & 0 deletions Starnet.Tests/Integration/RichPresenceRequestTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using LBPUnion.Starnet.Types.Entities.RichPresence;
using Xunit;

namespace LBPUnion.Starnet.Tests.Integration;

[Trait("Category", "Integration")]
public class RichPresenceRequestTests
{
private readonly LighthouseClient client = new();

[Fact]
public async Task RichPresenceRequests_CanGetRichPresence()
{
RichPresenceEntity? richPresenceEntity = await this.client.GetRpcConfigurationAsync();
Assert.NotNull(richPresenceEntity);
Assert.NotNull(richPresenceEntity.Assets);

Assert.Equal("1060973475151495288", richPresenceEntity.ApplicationId);
Assert.Equal("beacon", richPresenceEntity.PartyIdPrefix);
Assert.Equal("Integer", richPresenceEntity.UsernameType.ToString());
}
}
34 changes: 25 additions & 9 deletions Starnet/Types/Entities/RichPresence/RichPresenceAssetsEntity.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
using JetBrains.Annotations;
using System.Text.Json.Serialization;
using JetBrains.Annotations;

namespace LBPUnion.Starnet.Types.Entities.RichPresence;

[PublicAPI]
[Serializable]
public class RichPresenceAssetsEntity
{
public bool UseApplicationAssets { get; init; }
public string? PodAsset { get; init; }
public string? MoonAsset { get; init; }
public string? RemoteMoonAsset { get; init; }
public string? DeveloperAsset { get; init; }
public string? DeveloperAdventureAsset { get; init; }
public string? DlcAsset { get; init; }
public string? FallbackAsset { get; init; }
[JsonPropertyName("useApplicationAssets")]
public bool UseApplicationAssets { get; set; }

[JsonPropertyName("podAsset")]
public string? PodAsset { get; set; }

[JsonPropertyName("moonAsset")]
public string? MoonAsset { get; set; }

[JsonPropertyName("remoteMoonAsset")]
public string? RemoteMoonAsset { get; set; }

[JsonPropertyName("developerAsset")]
public string? DeveloperAsset { get; set; }

[JsonPropertyName("developerAdventureAsset")]
public string? DeveloperAdventureAsset { get; set; }

[JsonPropertyName("dlcAsset")]
public string? DlcAsset { get; set; }

[JsonPropertyName("fallbackAsset")]
public string? FallbackAsset { get; set; }
}
8 changes: 8 additions & 0 deletions Starnet/Types/Entities/RichPresence/RichPresenceEntity.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#nullable disable

using System.Text.Json.Serialization;
using JetBrains.Annotations;
using LBPUnion.Starnet.Types.Enums;

Expand All @@ -9,8 +10,15 @@ namespace LBPUnion.Starnet.Types.Entities.RichPresence;
[Serializable]
public class RichPresenceEntity
{
[JsonPropertyName("applicationId")]
public string ApplicationId { get; set; }

[JsonPropertyName("partyIdPrefix")]
public string PartyIdPrefix { get; set; }

[JsonPropertyName("usernameType")]
public UsernameType UsernameType { get; set; }

[JsonPropertyName("assets")]
public RichPresenceAssetsEntity Assets { get; set; }
}

0 comments on commit 1d57cc0

Please sign in to comment.