checkPlanAvailability static method

Future<void> checkPlanAvailability(
  1. Client cloudApiClient, {
  2. required CommandLogger logger,
  3. String? planName,
})

Subcommand to check if the user is subscribed to a plan, and if not whether a plan can be procured. If planName is not provided, the default plan will be assumed. Throws an exception if there is no subscription and the plan cannot be procured.

Implementation

static Future<void> checkPlanAvailability(
  final Client cloudApiClient, {
  required final CommandLogger logger,
  final String? planName,
}) async {
  final planNames = await cloudApiClient.plans.listProcuredPlanNames();
  if (planNames.isEmpty) {
    await cloudApiClient.plans.checkPlanAvailability(
      planName: planName ?? defaultPlanName,
    );
  }
}