Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Application Approximate User Install Count #2978

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 6 additions & 2 deletions 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 @@ -151,7 +154,8 @@ internal void Update(Model model)
if (model.RedirectUris.IsSpecified)
RedirectUris = model.RedirectUris.Value.ToImmutableArray();

ApproximateGuildCount = model.ApproximateGuildCount.IsSpecified ? model.ApproximateGuildCount.Value : null;
ApproximateGuildCount = model.ApproximateGuildCount.IsSpecified ? model.ApproximateGuildCount.Value : null;
AHollowedHunter marked this conversation as resolved.
Show resolved Hide resolved
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