getPlan method

  1. @override
Future<CalendarPlan> getPlan(
  1. String token
)
override

Fetches the plan for the user associated with the given token.

Implementation

@override
Future<CalendarPlan> getPlan(String token) async {
  log('Fetching plan');

  try {
    final response = await _apiService.callFunction(
      function: 'local_lbplanner_plan_get_plan',
      token: token,
      body: {},
    );

    response.assertJson();

    log('Plan fetched');

    return CalendarPlan.fromJson(response.asJson);
  } catch (e, s) {
    log('Failed to fetch plan', e, s);
    rethrow;
  }
}