diff --git a/lib/src/client_options.dart b/lib/src/client_options.dart index 59f04ce1f..5e8c2356e 100644 --- a/lib/src/client_options.dart +++ b/lib/src/client_options.dart @@ -18,6 +18,7 @@ import 'package:nyxx/src/models/role.dart'; import 'package:nyxx/src/models/sku.dart'; import 'package:nyxx/src/models/sticker/global_sticker.dart'; import 'package:nyxx/src/models/sticker/guild_sticker.dart'; +import 'package:nyxx/src/models/subscription.dart'; import 'package:nyxx/src/models/user/user.dart'; import 'package:nyxx/src/models/voice/voice_state.dart'; import 'package:nyxx/src/models/webhook.dart'; @@ -112,6 +113,9 @@ class RestClientOptions extends ClientOptions { /// The [CacheConfig] to use for the [Application.skus] manager. final CacheConfig skuConfig; + /// Tje [CacheConfig] to use for the [Sku.subscriptions] manager. + final CacheConfig subscriptionConfig; + /// Create a new [RestClientOptions]. const RestClientOptions({ super.plugins, @@ -137,6 +141,7 @@ class RestClientOptions extends ClientOptions { this.commandPermissionsConfig = const CacheConfig(), this.entitlementConfig = const CacheConfig(), this.skuConfig = const CacheConfig(), + this.subscriptionConfig = const CacheConfig(), }); } diff --git a/lib/src/http/managers/subscription_manager.dart b/lib/src/http/managers/subscription_manager.dart index d9980118f..97c251478 100644 --- a/lib/src/http/managers/subscription_manager.dart +++ b/lib/src/http/managers/subscription_manager.dart @@ -10,7 +10,7 @@ class SubscriptionManager extends ReadOnlyManager { final Snowflake applicationId; final Snowflake skuId; - SubscriptionManager(super.client, super.config, {required this.applicationId, required this.skuId}) + SubscriptionManager(super.config, super.client, {required this.applicationId, required this.skuId}) : super(identifier: '$applicationId.$skuId.subscriptions'); @override diff --git a/lib/src/models/sku.dart b/lib/src/models/sku.dart index d19106312..f941eee16 100644 --- a/lib/src/models/sku.dart +++ b/lib/src/models/sku.dart @@ -1,4 +1,5 @@ import 'package:nyxx/src/http/managers/sku_manager.dart'; +import 'package:nyxx/src/http/managers/subscription_manager.dart'; import 'package:nyxx/src/models/application.dart'; import 'package:nyxx/src/models/snowflake.dart'; import 'package:nyxx/src/models/snowflake_entity/snowflake_entity.dart'; @@ -10,6 +11,10 @@ class PartialSku extends ManagedSnowflakeEntity { @override final SkuManager manager; + /// A manager for this [Sku]'s [Subscription]s. + SubscriptionManager get subscriptions => + SubscriptionManager(manager.client.options.subscriptionConfig, manager.client, applicationId: manager.applicationId, skuId: id); + /// @nodoc PartialSku({required this.manager, required super.id}); }