Skip to content

Commit

Permalink
Add Application Approximate User Install Count (#2978)
Browse files Browse the repository at this point in the history
* Add Application Approximate User Install Count

* fix rider formatting moment
  • Loading branch information
AHollowedHunter authored Aug 9, 2024
1 parent 5407e17 commit 47f98bc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Discord.Net.Core/Entities/Applications/IApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ public interface IApplication : ISnowflakeEntity
/// </summary>
int? ApproximateGuildCount { get; }

/// <summary>
/// Gets the approximate count of the users the application was added to. <see langword="null" /> if not returned.
/// </summary>
int? ApproximateUserInstallCount { get; }

/// <summary>
/// Gets the application's discoverability state.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions src/Discord.Net.Rest/API/Common/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ internal class Application
[JsonProperty("approximate_guild_count")]
public Optional<int> ApproximateGuildCount { get; set; }

[JsonProperty("approximate_user_install_count")]
public Optional<int> ApproximateUserInstallCount { get; set; }

[JsonProperty("guild")]
public Optional<PartialGuild> PartialGuild { get; set; }

Expand Down
6 changes: 5 additions & 1 deletion src/Discord.Net.Rest/Entities/RestApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public class RestApplication : RestEntity<ulong>, IApplication
/// <inheritdoc />
public int? ApproximateGuildCount { get; private set; }

/// <inheritdoc />
public int? ApproximateUserInstallCount { get; private set; }

/// <inheritdoc />
public IReadOnlyCollection<string> RedirectUris { get; private set; }

Expand Down Expand Up @@ -152,6 +155,7 @@ internal void Update(Model model)
RedirectUris = model.RedirectUris.Value.ToImmutableArray();

ApproximateGuildCount = model.ApproximateGuildCount.IsSpecified ? model.ApproximateGuildCount.Value : null;
ApproximateUserInstallCount = model.ApproximateUserInstallCount.IsSpecified ? model.ApproximateUserInstallCount.Value : null;

DiscoverabilityState = model.DiscoverabilityState.GetValueOrDefault(ApplicationDiscoverabilityState.None);
DiscoveryEligibilityFlags = model.DiscoveryEligibilityFlags.GetValueOrDefault(DiscoveryEligibilityFlags.None);
Expand All @@ -168,7 +172,7 @@ internal void Update(Model model)
RpcState = model.RpcState.GetValueOrDefault(ApplicationRpcState.Disabled);
StoreState = model.StoreState.GetValueOrDefault(ApplicationStoreState.None);
VerificationState = model.VerificationState.GetValueOrDefault(ApplicationVerificationState.Ineligible);

var dict = new Dictionary<ApplicationIntegrationType, ApplicationInstallParams>();
if (model.IntegrationTypesConfig.IsSpecified)
{
Expand Down

0 comments on commit 47f98bc

Please sign in to comment.