-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement support for monetized apps.
See discord/discord-api-docs#6451, discord/discord-api-docs#6452, and discord/discord-api-docs#6477.
- Loading branch information
Showing
49 changed files
with
1,651 additions
and
17 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...end/Remora.Discord.API.Abstractions/API/Gateway/Events/Monetization/IEntitlementCreate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// IEntitlementCreate.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <jarl.gullberg@gmail.com> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using JetBrains.Annotations; | ||
using Remora.Discord.API.Abstractions.Objects; | ||
|
||
namespace Remora.Discord.API.Abstractions.Gateway.Events; | ||
|
||
/// <summary> | ||
/// Represents a user's initial subscription to an SKU. | ||
/// </summary> | ||
[PublicAPI] | ||
public interface IEntitlementCreate : IEntitlement, IGatewayEvent | ||
{ | ||
} |
34 changes: 34 additions & 0 deletions
34
...end/Remora.Discord.API.Abstractions/API/Gateway/Events/Monetization/IEntitlementDelete.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// IEntitlementDelete.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <jarl.gullberg@gmail.com> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using JetBrains.Annotations; | ||
using Remora.Discord.API.Abstractions.Objects; | ||
|
||
namespace Remora.Discord.API.Abstractions.Gateway.Events; | ||
|
||
/// <summary> | ||
/// Represents a removal of an entitlement from a user. | ||
/// </summary> | ||
[PublicAPI] | ||
public interface IEntitlementDelete : IEntitlement, IGatewayEvent | ||
{ | ||
} |
34 changes: 34 additions & 0 deletions
34
...end/Remora.Discord.API.Abstractions/API/Gateway/Events/Monetization/IEntitlementUpdate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// IEntitlementUpdate.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <jarl.gullberg@gmail.com> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using JetBrains.Annotations; | ||
using Remora.Discord.API.Abstractions.Objects; | ||
|
||
namespace Remora.Discord.API.Abstractions.Gateway.Events; | ||
|
||
/// <summary> | ||
/// Represents a renewal of a user's entitlement to an SKU. | ||
/// </summary> | ||
[PublicAPI] | ||
public interface IEntitlementUpdate : IEntitlement, IGatewayEvent | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
Backend/Remora.Discord.API.Abstractions/API/Objects/Monetization/EntitlementOwnerType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// EntitlementOwnerType.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <jarl.gullberg@gmail.com> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using JetBrains.Annotations; | ||
|
||
namespace Remora.Discord.API.Abstractions.Objects; | ||
|
||
/// <summary> | ||
/// Enumerates various entitlement owner types. | ||
/// </summary> | ||
[PublicAPI] | ||
public enum EntitlementOwnerType | ||
{ | ||
/// <summary> | ||
/// The entitlement is owned by a guild. | ||
/// </summary> | ||
Guild = 1, | ||
|
||
/// <summary> | ||
/// The entitlement is owned by a user. | ||
/// </summary> | ||
User = 2 | ||
} |
37 changes: 37 additions & 0 deletions
37
Backend/Remora.Discord.API.Abstractions/API/Objects/Monetization/EntitlementType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// EntitlementType.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <jarl.gullberg@gmail.com> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using JetBrains.Annotations; | ||
|
||
namespace Remora.Discord.API.Abstractions.Objects; | ||
|
||
/// <summary> | ||
/// Enumerates various entitlement types. | ||
/// </summary> | ||
[PublicAPI] | ||
public enum EntitlementType | ||
{ | ||
/// <summary> | ||
/// The entitlement was purchased as an app subscription. | ||
/// </summary> | ||
ApplicationSubscription = 8 | ||
} |
106 changes: 106 additions & 0 deletions
106
Backend/Remora.Discord.API.Abstractions/API/Objects/Monetization/IEntitlement.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// | ||
// IEntitlement.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <jarl.gullberg@gmail.com> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using System; | ||
using JetBrains.Annotations; | ||
using Remora.Rest.Core; | ||
|
||
namespace Remora.Discord.API.Abstractions.Objects; | ||
|
||
/// <summary> | ||
/// Represents information about a user's access to monetized application features. | ||
/// </summary> | ||
[PublicAPI] | ||
public interface IEntitlement : IPartialEntitlement | ||
{ | ||
/// <summary> | ||
/// Gets the ID of the entitlement. | ||
/// </summary> | ||
new Snowflake ID { get; } | ||
|
||
/// <summary> | ||
/// Gets the ID of the SKU. | ||
/// </summary> | ||
new Snowflake SKUID { get; } | ||
|
||
/// <summary> | ||
/// Gets the ID of the parent application. | ||
/// </summary> | ||
new Snowflake ApplicationID { get; } | ||
|
||
/// <summary> | ||
/// Gets the ID of the user that is granted access to the entitlement's SKU. | ||
/// </summary> | ||
new Optional<Snowflake> UserID { get; } | ||
|
||
/// <summary> | ||
/// Gets the type of the entitlement. | ||
/// </summary> | ||
new EntitlementType Type { get; } | ||
|
||
/// <summary> | ||
/// Gets a value indicating whether the entitlement has been deleted. | ||
/// </summary> | ||
new bool IsDeleted { get; } | ||
|
||
/// <summary> | ||
/// Gets the start time at which the entitlement is valid. | ||
/// </summary> | ||
new Optional<DateTimeOffset> StartsAt { get; } | ||
|
||
/// <summary> | ||
/// Gets the end time at which the entitlement is no longer valid. | ||
/// </summary> | ||
new Optional<DateTimeOffset> EndsAt { get; } | ||
|
||
/// <summary> | ||
/// Gets the ID of the guild that is granted access to the entitlement's SKU. | ||
/// </summary> | ||
new Optional<Snowflake> GuildID { get; } | ||
|
||
/// <inheritdoc/> | ||
Optional<Snowflake> IPartialEntitlement.ID => this.ID; | ||
|
||
/// <inheritdoc/> | ||
Optional<Snowflake> IPartialEntitlement.SKUID => this.SKUID; | ||
|
||
/// <inheritdoc/> | ||
Optional<Snowflake> IPartialEntitlement.UserID => this.UserID; | ||
|
||
/// <inheritdoc/> | ||
Optional<Snowflake> IPartialEntitlement.GuildID => this.GuildID; | ||
|
||
/// <inheritdoc/> | ||
Optional<Snowflake> IPartialEntitlement.ApplicationID => this.ApplicationID; | ||
|
||
/// <inheritdoc/> | ||
Optional<EntitlementType> IPartialEntitlement.Type => this.Type; | ||
|
||
/// <inheritdoc/> | ||
Optional<bool> IPartialEntitlement.IsDeleted => this.IsDeleted; | ||
|
||
/// <inheritdoc/> | ||
Optional<DateTimeOffset> IPartialEntitlement.StartsAt => this.StartsAt; | ||
|
||
/// <inheritdoc/> | ||
Optional<DateTimeOffset> IPartialEntitlement.EndsAt => this.EndsAt; | ||
} |
61 changes: 61 additions & 0 deletions
61
Backend/Remora.Discord.API.Abstractions/API/Objects/Monetization/IPartialEntitlement.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// IPartialEntitlement.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <jarl.gullberg@gmail.com> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using System; | ||
using JetBrains.Annotations; | ||
using Remora.Rest.Core; | ||
|
||
namespace Remora.Discord.API.Abstractions.Objects; | ||
|
||
/// <summary> | ||
/// Represents partial information about a user's access to monetized application features. | ||
/// </summary> | ||
[PublicAPI] | ||
public interface IPartialEntitlement | ||
{ | ||
/// <inheritdoc cref="IEntitlement.ID"/> | ||
Optional<Snowflake> ID { get; } | ||
|
||
/// <inheritdoc cref="IEntitlement.SKUID"/> | ||
Optional<Snowflake> SKUID { get; } | ||
|
||
/// <inheritdoc cref="IEntitlement.ApplicationID"/> | ||
Optional<Snowflake> ApplicationID { get; } | ||
|
||
/// <inheritdoc cref="IEntitlement.UserID"/> | ||
Optional<Snowflake> UserID { get; } | ||
|
||
/// <inheritdoc cref="IEntitlement.Type"/> | ||
Optional<EntitlementType> Type { get; } | ||
|
||
/// <inheritdoc cref="IEntitlement.IsDeleted"/> | ||
Optional<bool> IsDeleted { get; } | ||
|
||
/// <inheritdoc cref="IEntitlement.StartsAt"/> | ||
Optional<DateTimeOffset> StartsAt { get; } | ||
|
||
/// <inheritdoc cref="IEntitlement.EndsAt"/> | ||
Optional<DateTimeOffset> EndsAt { get; } | ||
|
||
/// <inheritdoc cref="IEntitlement.GuildID"/> | ||
Optional<Snowflake> GuildID { get; } | ||
} |
Oops, something went wrong.