Skip to content

Commit

Permalink
Add missing subscription manager getter (#703)
Browse files Browse the repository at this point in the history
  • Loading branch information
abitofevrything authored Oct 5, 2024
1 parent d8d90f6 commit 4b2b11b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/src/client_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -112,6 +113,9 @@ class RestClientOptions extends ClientOptions {
/// The [CacheConfig] to use for the [Application.skus] manager.
final CacheConfig<Sku> skuConfig;

/// Tje [CacheConfig] to use for the [Sku.subscriptions] manager.
final CacheConfig<Subscription> subscriptionConfig;

/// Create a new [RestClientOptions].
const RestClientOptions({
super.plugins,
Expand All @@ -137,6 +141,7 @@ class RestClientOptions extends ClientOptions {
this.commandPermissionsConfig = const CacheConfig(),
this.entitlementConfig = const CacheConfig(),
this.skuConfig = const CacheConfig(),
this.subscriptionConfig = const CacheConfig(),
});
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/http/managers/subscription_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SubscriptionManager extends ReadOnlyManager<Subscription> {
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
Expand Down
5 changes: 5 additions & 0 deletions lib/src/models/sku.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -10,6 +11,10 @@ class PartialSku extends ManagedSnowflakeEntity<Sku> {
@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});
}
Expand Down

0 comments on commit 4b2b11b

Please sign in to comment.